Setting Up Your Development Environment
The Ocre toolchain for C/C++ is provided as a Docker container image to ensure a consistent development environment for building containerzied applications with Ocre. You can utilize this container in two ways:
-
Using Visual Studio Code with Dev Containers: Provides an integrated development experience with full IDE support and container management.
-
Using Docker Interactively: Offers a straightforward command-line interface for building and testing Ocre containers.
Choose the method that best suits your development workflow. Both approaches provide the same toolchain capabilities, just with different interfaces and features.
Developing with Visual Studio Code
A Development Container (or dev container) is a Docker container that provides a complete development environment. With a dev container, the VS Code editor operates on your local machine while the Ocre toolchain runs inside the container, ensuring a consistent and isolated development environment.
Prerequisites
Before you begin, ensure that you have the following tools installed on your development machine:
- Docker Desktop: Required to run Docker containers.
- Visual Studio Code: A lightweight but powerful source code editor.
- Dev Containers Extension: This extension allows you to use Docker containers as development environments within VS Code.
The dev container can also be run directly in GitHub via CodeSpaces, though you will only be able to build Ocre containers, not load them on your device as the dev container will not have access to your local devices.
Steps
- Install Prerequisites: Follow the links above to install Docker Desktop, VS Code, and the Dev Containers extension.
- Clone the Repository:
git clone https://github.com/project-ocre/getting-started.git
- Open Visual Studio Code: Launch VSCode on your machine.
- Open Folder in Container:
- Run the command
Dev Containers: Open Folder in Container...
from the Command Palette (Cmd + Shift + P or Ctrl + Shift + P). - Select the folder containing the cloned repository.
- Run the command
Once you select the folder, VS Code will reload. If the container does not exist yet, it will automatically create one and clone the sample repository into an isolated container volume. This process may take a few moments, and progress will be displayed in the lower right corner of the VS Code window. After the container is ready, you can open a terminal within VS Code to access the container environment.
Additional documentation and a step-by-step guide for working with dev containers can be found here.
Interactive Development
The toolchain container can also be launched and used interactively as follows:
- Clone the Repository:
git clone https://github.com/project-ocre/getting-started.git
- Run the following command
cd getting-started docker run --rm -it -v $(pwd):/home/ocre ghcr.io/atym-io/atym-c-toolchain:latest
At the moment, there is not a docker image that contains the Ocre toolchain. While we’re working on getting that up, please use the atym
toolchain in the above example.
Troubleshooting
This section covers common issues you might encounter when setting up your development environment, along with their solutions.
- If you encounter errors opening the dev container, you likely need to authenticate with the GitHub Container Registry. Follow the authentication steps in the GitHub documentation.
Next Steps
Once you’re set up your development environment, head over to the Building And Deploying Your First Container page to learn how to build and deploy your first container using Ocre.