From 08e8d4baf1be909c24085dc990f8a1ca2e4b80b1 Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Thu, 31 Oct 2024 16:47:23 +0000 Subject: [PATCH] switch devcontainer build to use devcontainer/ci action --- .devcontainer/devcontainer.json | 11 ++++++----- .github/workflows/devcontainer.yml | 18 +++++++----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 81070d67..4f5ceb6a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,10 +1,11 @@ { // Uncomment this and comment "image" out for local devcontainer building. - // "build": { - // "dockerfile": "Dockerfile", - // "context": "../" - // }, - "image": "ghcr.io/nrel/buildingmotif/devcontainer:ts-devcontainers", + "build": { + "dockerfile": "Dockerfile", + "context": "../", + "cacheFrom": "ghcr.io/nrel/buildingmotif/devcontainer:ts-devcontainers" + }, + // "image": "ghcr.io/nrel/buildingmotif/devcontainer:ts-devcontainers", "runArgs": ["--net=host"], // Use host network for webapp (which only listens for localhost by default) "features": { "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}, diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 768ec9a3..edc6cff8 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -42,15 +42,11 @@ jobs: type=sha type=edge - - name: Build and push - uses: docker/build-push-action@v6 + - name: Pre-build dev container image + uses: devcontainers/ci@v0.3 with: - context: . - file: .devcontainer/Dockerfile - push: true - target: devcontainer - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.output.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + imageName: ${{ env.REGISTRY }}/${{ github.repository }}/devcontainer:ts-devcontainers + imageTag: ${{ steps.meta.outputs.tags }} + cacheFrom: ${{ env.REGISTRY }}/${{ github.repository }}/devcontainer:ts-devcontainers + push: always + platform: linux/amd64,linux/arm64