Skip to content

Commit

Permalink
ci(github): fix VSCode dev container publish job - use official builder
Browse files Browse the repository at this point in the history
1. We don't have a Dockerfile anymore to define the image of the dev container
instead the build's input is the `devcontainer.json` file which can be built
using the `@devcontainers/cli` npm package instead of the usual `docker build`
command on the terminal.
2. The ci.yaml job building the image was already doing the build this way but
we must've forgotten to update the publish job as well.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
petermetz committed Jun 14, 2024
1 parent c18b3fc commit e680730
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/dev-container-vscode-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concurrency:

env:
IMAGE_NAME: cactus-dev-container-vscode
NODEJS_VERSION: v18.18.2

jobs:
# Push image to GitHub Packages.
Expand All @@ -31,15 +32,17 @@ jobs:
contents: read

steps:
- name: Use Node.js ${{ env.NODEJS_VERSION }}
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ env.NODEJS_VERSION }}
- uses: actions/checkout@v4.1.1

- name: Build image
run: docker build "$DOCKER_BUILD_DIR" --file "$DOCKERFILE_PATH" --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}"

- name: npm_install_@devcontainers/cli@0.44.0
run: npm install -g @devcontainers/cli@0.44.0
- name: npx_yes_devcontainers_cli_build
run: npx --yes @devcontainers/cli@0.44.0 build --workspace-folder="./" --log-level=trace --push=false --config="./.devcontainer/devcontainer.json" --image-name="$IMAGE_NAME"
- name: Log in to registry
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
SHORTHASH=$(git rev-parse --short "$GITHUB_SHA")
Expand Down

0 comments on commit e680730

Please sign in to comment.