0

I found a couple other questions around here like this, with no answers.

I am using this project to prebuild a devcontainer and push it to Github Container Registry: https://github.com/devcontainers/ci/blob/main/docs/github-action.md

The relevant Github action step looks like this:

  - name: Build and run Dev Container task
    uses: devcontainers/ci@v0.3
    with:
      imageName: "ghcr.io/${{ env.OWNER_LC }}/dev-infra-environment"
      cacheFrom: "ghcr.io/${{ env.OWNER_LC }}/dev-infra-environment"
      push: filter
      refFilterForPush: refs/heads/main

After reviewing the logs, the postCreateCommand defined in the devcontainer.json is not executed. And when I pull the image in vscode to use as a devcontainer, it runs the postCreateCommand then.

Is there a way to get the postCreateCommand (or some other mechanism) to run when the devcontainer is being built, so that everything is included in the final image? Documentation is really sparse on this, or any other mechanism for prebuilding devcontainers.

Appleoddity
  • 647
  • 1
  • 6
  • 21

1 Answers1

0

According to the documentation the postCreateCommand is executed when container is created, it's not feasible for pre-builds. If you want to pre-build, there are many different options available. I'd consider using features (if available) or building from a Dockerfile with all required packages.

secret
  • 61
  • 6