Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: target and build args properties in devcontainer.json #2409

Closed
2 tasks done
chrmarti opened this issue Feb 23, 2020 · 1 comment
Closed
2 tasks done

Test: target and build args properties in devcontainer.json #2409

chrmarti opened this issue Feb 23, 2020 · 1 comment

Comments

@chrmarti
Copy link
Contributor

chrmarti commented Feb 23, 2020

Refs: #46

Complexity: 4


On setting up DevContainers for testing: https://github.com/microsoft/vscode-remote-containers/blob/master/CONTRIBUTING.md#testing-remote-containers

Test the new target and build args properties and the alternative placing of dockerfile and context (check that dockerFile and context can still be used as top-level properties):

{
    "build": {
        "dockerfile": "...",
        "context": "...",
        "target": "...",
        "args": {
            "FOO": "BAR"
        }
    }
}

Note that the top-level dockerFile property has a capital F (for compatibility) and the nested property is all lowercase dockerfile (for consistency with Dockerfile).

Docker documentation for target: https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target

Docker documentation for build args: https://docs.docker.com/engine/reference/builder/#arg

Example Dockerfile for testing:

FROM node:12 AS base

RUN touch /foobar.base

FROM base AS dev

RUN touch /foobar.dev

ARG FOO=BAR
RUN echo $FOO >/foo.txt

FROM base AS prod

RUN touch /foobar.prod
@chrmarti
Copy link
Contributor Author

Note that the casing for dockerfile inside build changed to all lowercase in 0.104.0 of the extension (schema update in 2/26 Insiders). The top-level property is still dockerFile with a capital F for compatibility.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants