Closed lukin0110 closed 8 months ago
+1 for almost the same requirements.
Seems this can be done with a combination of build.args
in devcontainer.json
and env
in GitHub Actions. Related code snippets are like the following:
{
"build": {
"args": {
"PYTHON_VERSION": "${localEnv:PYTHON_VERSION}"
},
}
}
- uses: devcontainers/ci@v0.3
env:
PYTHON_VERSION: ${{ matrix.python-version }}
with:
imageName: ghcr.io/${{ github.repository }}
imageTag: ${{ matrix.python-version }}
I have an ongoing pull request for this: https://github.com/serious-scaffold/ss-python/pull/263
It is partialy mentioned here (https://github.com/devcontainers/ci/blob/main/docs/github-action.md#remoteenv), but not so straightforward. Maybe we should improve the documentation.
@huxuan thanks for the suggestion. I've applied your fix and it works as expected. I'm using docker compose
in the devontainer.json
but the principle is the same.
It does make sense to manage build args through the devcontainer.json
config file. It's not the responsibility of this GitHub Action. I'm closing the issue.
To test a python package I'm using a matrix build and I want to be able to build different
devcontainer
images for different python versions. In order to that I need to be able to specify the python version at build time.Possible example syntax:
I can open a merge request to implement this solution if we agree on the approach.