Skip to content

Commit

Permalink
GHA Docker: Add labels and tags
Browse files Browse the repository at this point in the history
  • Loading branch information
quartje committed Jan 30, 2024
1 parent cc190d7 commit b49e61e
Showing 1 changed file with 54 additions and 42 deletions.
96 changes: 54 additions & 42 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
name: build-push-docker-image

on:
push:
branches: feature/docker_configs
workflow_dispatch:
push:
branches: feature/docker_configs
workflow_dispatch:

jobs:
build-push-docker-image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get the latest release
id: release
uses: robinraju/[email protected]
with:
latest: true
fileName: "*.tar.bz2"

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

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the Production image
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile.prod
platforms: linux/amd64
push: true
tags: |
ghcr.io/openconext/openconext-engineblock/openconext-engineblock:prod
ghcr.io/openconext/openconext-engineblock/openconext-engineblock:${{ github.sha }}
ghcr.io/openconext/openconext-engineblock/openconext-engineblock:${{ steps.release.outputs.tag_name }}
build-push-docker-image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get the latest release
id: release
uses: robinraju/[email protected]
with:
latest: true
fileName: "*.tar.gz"

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

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set docker metadata for the container
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/openconext/openconext-engineblock/engineblock
tags: |
type=ref,event=tag
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push the Production image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.prod
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit b49e61e

Please sign in to comment.