Skip to content

Commit

Permalink
ci: build container images for linux/arm64 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
romansey committed Mar 25, 2022
1 parent 40e7846 commit a9a939d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
version:
required: true
type: string
platforms:
required: false
type: string
default: "linux/amd64,linux/arm64"
working-dir:
required: true
type: string
Expand All @@ -24,28 +28,32 @@ jobs:
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v2
- name: Download artifact
- name: 📦 Download artifact
uses: actions/download-artifact@v2
if: inputs.artifact-name && inputs.artifact-path
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.artifact-path }}
- name: 🦤 Set up qemu
uses: docker/setup-qemu-action@v1
- name: 🐳 Set up docker buildx
uses: docker/setup-buildx-action@v1
- name: 🧰 Build container image
if: github.ref != 'refs/heads/main' || inputs.version == 'dev'
working-directory: ${{ inputs.working-dir }}
run: |
docker build \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .
run: docker buildx build --platform "${{ inputs.platforms }}" .
- name: 🔑 Login to GitHub Container registry
if: github.ref == 'refs/heads/main' && inputs.version != 'dev'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: ⬆️ Push container image
- name: 🧰 ⬆️ Build and push container image
if: github.ref == 'refs/heads/main' && inputs.version != 'dev'
working-directory: ${{ inputs.working-dir }}
run: |
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest"
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)"
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}"
docker buildx build --push --platform "${{ inputs.platforms }}" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .

0 comments on commit a9a939d

Please sign in to comment.