Skip to content

Commit

Permalink
tweak: Switch to the official Docker build script
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Jun 7, 2024
1 parent da17cd2 commit 9c02930
Showing 1 changed file with 30 additions and 36 deletions.
66 changes: 30 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,12 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Build Dockerfile
run: docker build . --file Dockerfile --tag image --platform linux/amd64,linux/arm64

- run: |
docker run --rm -t -v $PWD:/volume image cp /app/$HANDLER_NAME /volume/handler
mv ./handler ./$HANDLER_NAME
- name: Save handler artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.HANDLER_NAME }}
path: ${{ env.HANDLER_NAME }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registries
if: github.event_name == 'push'
Expand All @@ -55,30 +49,30 @@ jobs:
run: |
VERSION=$(git describe --tags 2>/dev/null || git rev-parse --short HEAD)
echo "::set-output name=version::$VERSION"
- name: Push image to GitHub
if: github.event_name == 'push'
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ github.event.repository.name }}
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag image $IMAGE_ID:latest
docker push $IMAGE_ID:latest
docker tag image $IMAGE_ID:${{ steps.version.outputs.version }}
docker push $IMAGE_ID:${{ steps.version.outputs.version }}
- name: Push image to Docker Hub
if: github.event_name == 'push'
run: |
IMAGE_ID=${{ env.IMAGE }}
echo IMAGE_ID=$IMAGE_ID
docker tag image $IMAGE_ID:latest
docker push $IMAGE_ID:latest
docker tag image $IMAGE_ID:${{ steps.version.outputs.version }}
docker push $IMAGE_ID:${{ steps.version.outputs.version }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
labels: org.opencontainers.image.authors=SierraSoftworks,org.opencontainers.image.version=${{ steps.version.outputs.version }},org.opencontainers.image.revision=${{ github.sha }}
tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ steps.version.outputs.version }},docker.pkg.github.com/${{ github.repository }}/${{ github.event.repository.name }}:latest,docker.pkg.github.com/${{ github.repository }}/${{ github.event.repository.name }}:${{ steps.version.outputs.version }}

- run: |
docker run --rm -t -v $PWD:/volume ${{ env.IMAGE }}:${{ steps.version.outputs.version }} cp /app/$HANDLER_NAME /volume/handler
mv ./handler ./$HANDLER_NAME
- name: Save handler artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.HANDLER_NAME }}
path: ${{ env.HANDLER_NAME }}

deploy-staging:
needs: build

runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
environment:
name: Staging
Expand Down Expand Up @@ -107,7 +101,7 @@ jobs:

healthcheck-staging:
needs: deploy-staging
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Probe
Expand All @@ -125,7 +119,7 @@ jobs:
name: Production
url: ${{ env.LIVE_HEALTHCHECK }}

runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -150,7 +144,7 @@ jobs:

healthcheck-live:
needs: deploy-live
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Probe
Expand Down

0 comments on commit 9c02930

Please sign in to comment.