From 843c42d38a4a00a851cbd5424374dd82071b5f93 Mon Sep 17 00:00:00 2001 From: Kat Morgan Date: Mon, 22 Jan 2024 20:37:55 +0000 Subject: [PATCH] re-enable conditional build --- .github/workflows/container.yaml | 63 ++++++++++++++++---------------- docker/.dockerignore | 41 --------------------- docker/Dockerfile | 20 +++++----- 3 files changed, 41 insertions(+), 83 deletions(-) delete mode 100644 docker/.dockerignore diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml index a03f8f5..cc34d45 100644 --- a/.github/workflows/container.yaml +++ b/.github/workflows/container.yaml @@ -76,44 +76,43 @@ jobs: uses: Entepotenz/change-string-case-action-min-dependencies@v1 with: string: ${{ github.repository }} -# - -# name: Build Container Image -# id: docker_build -# uses: docker/build-push-action@v5 -# with: -# push: false -# load: true -# cache-to: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }} -# cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }} -# context: docker -# file: docker/Dockerfile -# platforms: linux/amd64,linux/arm64 -# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}" -# - -# name: Push Container Image -# id: docker_build_push -# #if: ${{ github.event_name == 'push' }} && ${{ github.ref == 'refs/heads/main' }} -# uses: docker/build-push-action@v5 -# with: -# push: true -# #oad: false -# #ache-to: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }} -# #ache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }} -# context: docker -# file: docker/Dockerfile -# platforms: linux/amd64,linux/arm64 -# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}" - - if: ${{ github.event_name == 'push' }} && ${{ github.ref == 'refs/heads/main' }} - name: Container Build & Push + name: Build Container Image + if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main') + uses: docker/build-push-action@v5 + with: + push: false + cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest + cache-to: type=inline + context: ./docker + file: ./docker/Dockerfile + platforms: linux/amd64,linux/arm64 + tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}" + + - + name: Push Container Image + if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: docker/build-push-action@v5 - id: container-push with: push: true - cache-from: type=inline + cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest + cache-to: type=inline context: ./docker file: ./docker/Dockerfile platforms: linux/amd64,linux/arm64 - annotations: '"annotations": { "org.opencontainers.image.description": "Pulumi Devcontainer" }' tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}" + +# - +# if: ${{ github.event_name == 'push' }} && ${{ github.ref == 'refs/heads/main' }} +# name: Container Build & Push +# uses: docker/build-push-action@v5 +# id: container-push +# with: +# push: true +# cache-from: type=inline +# context: ./docker +# file: ./docker/Dockerfile +# platforms: linux/amd64,linux/arm64 +# annotations: '"annotations": { "org.opencontainers.image.description": "Pulumi Devcontainer" }' +# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}" diff --git a/docker/.dockerignore b/docker/.dockerignore deleted file mode 100644 index f404459..0000000 --- a/docker/.dockerignore +++ /dev/null @@ -1,41 +0,0 @@ -# Default to ignore all files -* -.* - -# Exceptions to the default ignore rules -!.dockerignore -!Dockerfile -!rootfs - -# Ignore Python cache files -__pycache__/ -*.py[cod] - -# Ignore virtual environments -.env -.venv -env/ -venv/ - -# Ignore temporary and backup files -*.bak -*.swp -*.state - -# Ignore development environment configurations -.vscode/ -.idea/ - -# Ignore logs and databases -*.log -*.sqlite - -# Ignore OS generated files -.DS_Store -Thumbs.db - -# Ignore any sensitive files containing secrets or credentials -*.secrets - -# Ignore build artifacts for containerization (if any) -build/ diff --git a/docker/Dockerfile b/docker/Dockerfile index 92075e3..a677762 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -688,13 +688,13 @@ RUN set -ex \ && rm -rf /tmp/* \ && true -################################################################################## -## Load startup artifacts -#COPY ./docker/bin/connect /bin/ -#COPY ./docker/bin/entrypoint /bin/ -# -################################################################################## -## Entrypoint & default command -#WORKDIR /workspaces -#ENTRYPOINT /bin/entrypoint -#CMD ["/usr/bin/env", "connect"] \ No newline at end of file +################################################################################# +# Load startup artifacts +COPY ./docker/bin/connect /bin/ +COPY ./docker/bin/entrypoint /bin/ + +################################################################################# +# Entrypoint & default command +WORKDIR /workspaces +ENTRYPOINT /bin/entrypoint +CMD ["/usr/bin/env", "connect"] \ No newline at end of file