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

feature: Allow appending an arbitrary validation command to the built image #383

Open
johnstcn opened this issue Oct 14, 2024 · 0 comments

Comments

@johnstcn
Copy link
Member

Motivation

Some image building workflows involve a final RUN command that serves to in some way validate the built image before pushing it to a remote registry (example).

For example, we may want to run a security scan of the image for CVEs using e.g. trivy, or perform a final confidence check on the image using e.g. goss.

With Envbuilder, the built image is only available inside the running envbuilder container, so it can't be scanned easily by external processes.

Solution

Allow appending an arbitrary RUN command to the Dockerfile produced by Envbuilder. An example of such a command could be:

RUN curl -fsSL -o /tmp/validate.sh https://host.internal/validate.sh && \
    chmod +x /tmp/validate.sh && \
    /tmp/validate.sh && \
    rm -f /tmp/validate.sh

Alternatives

The above behaviour can be approximated with no code changes with the below:

  • Append a RUN command to the Dockerfile containing the specific check(s) they wish to run, or
  • Add the required validation steps to devcontainer.json as e.g. postCreateCommand, or
  • Create a specific devcontainer feature that runs the desired validation commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants