The Dev Container Build and Run GitHub Action is aimed at making it easier to re-use Dev Containers in a GitHub workflow. The Action supports using a Dev Container to run commands for CI, testing, and more, along with pre-building a Dev Container image. Dev Container image building supports Dev Container Features and automatically places Dev Container metadata on an image label for simplified use.
NOTE: The Action is not currently capable of taking advantage of pre-built Codespaces. However, pre-built images are supported.
Note that this project builds on top of @devcontainers/cli which can be used in other automation systems.
Here are three examples of using the Action for common scenarios. See the documentation for more details and a list of available inputs.
Pre-building an image:
- name: Pre-build dev container image
uses: step-security/devcontainers-ci@v0
with:
imageName: ghcr.io/example/example-devcontainer
cacheFrom: ghcr.io/example/example-devcontainer
push: alwaysUsing a Dev Container for a CI build:
- name: Run make ci-build in dev container
uses: step-security/devcontainers-ci@v0
with:
# [Optional] If you have a separate workflow like the one above
# to pre-build your container image, you can reference it here
# to speed up your application build workflows as well!
cacheFrom: ghcr.io/example/example-devcontainer
push: never
runCmd: make ci-buildBoth at once:
- name: Pre-build image and run make ci-build in dev container
uses: step-security/devcontainers-ci@v0
with:
imageName: ghcr.io/example/example-devcontainer
cacheFrom: ghcr.io/example/example-devcontainer
push: always
runCmd: make ci-build