We provide a development container hosted on GitHub Container Registry (ghcr) to serve as a complete development environment.
- Prerequisites
- Using in VSCode
- Using on the Command Line Interface (CLI)
- Local Build Process
- Run container action locally
-
Create a classic GitHub Personal Access Token (fine-grained isn't supported yet) with the following permissions taken from here:
- `read:packages` - `write:packages` - `delete:packages`
-
If you haven't already, install the Remote - Containers extension in Visual Studio Code.
-
Open the command palette in Visual Studio Code by pressing Ctrl + Shift + P (or Cmd + Shift + P on macOS) and run the
Remote-Containers: Reopen in Container
command. Visual Studio Code will build the Docker container using the provided Dockerfile and open the project inside the container.You can now work on your project within the container, and Visual Studio Code will utilize the Go, Python, and other tools installed in the container for tasks such as running, debugging, and linting.
To return to working on your project locally, open the command palette
and run the Remote-Containers: Reopen Locally
command.
-
Pull the latest image from ghcr:
docker pull ghcr.io/facebookincubator/ttpforge:latest
-
Run container and mount local project directory:
docker run -it --rm \ -v "$(pwd)":/home/ttpforge/go/src/github.com/facebookincubator/ttpforge \ ghcr.io/facebookincubator/ttpforge:latest
If, for any reason, you need to build the container image locally, follow the steps below.
Run the following commands to build the image locally:
docker build \
-t ghcr.io/facebookincubator/ttpforge \
-f .devcontainer/bash/Dockerfile .
-
Create a file called
.secrets
with the following:export BOT_TOKEN=YOUR_PAT_GOES_HERE export GITHUB_USERNAME=YOUR_GITHUB_USERNAME_GOES_HERE
-
Install Act
-
Run one of the actions:
# Run the container build, push, and test action act -j "test_pushed_images" \ --secret-file .secrets # Run the pre-commit action act -j "pre-commit" \ --secret-file .secrets \ --container-architecture linux/amd64