Skip to content

update packer build #62

update packer build

update packer build #62

name: Build VSCode Docker container
on:
push
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 3
- name: Check for changes
id: check_for_changes
run: |
echo "CHANGE_COUNT=$(git diff --name-only HEAD^ HEAD | grep 'docker' | wc -l)" >> "$GITHUB_OUTPUT"
- name: Info
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
run: |
echo "changes: ${{ steps.check_for_changes.outputs.CHANGE_COUNT }} event: ${{ github.event_name }}"
- name: Get version
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
id: version
run: |
echo "VERSION=$(cat docker/VERSION)" >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/setup-buildx-action@v2
- name: Build and push
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: docker
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/jumppad-labs/terraform-workshop:${{ steps.version.outputs.VERSION }}