Docker #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/docker/build-push-action | |
name: "Docker" | |
on: | |
release: # A GitHub release was published | |
types: [published] | |
workflow_dispatch: # A build was manually requested | |
workflow_call: # Another pipeline called us | |
secrets: | |
DOCKER_TOKEN: | |
required: true | |
env: | |
GHCR_NAMESPACE: neilalexander | |
PLATFORMS: linux/amd64 | |
#PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 | |
jobs: | |
monolith: | |
name: Monolith image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get release tag & build flags | |
if: github.event_name == 'release' # Only for GitHub releases | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Containers | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build monolith image | |
if: github.ref_name == 'main' || github.event_name == 'workflow_dispatch' | |
id: docker_build_monolith | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
ghcr.io/${{ env.GHCR_NAMESPACE }}/harmony:${{ github.ref_name }} | |
- name: Build release monolith image | |
if: github.event_name == 'release' # Only for GitHub releases | |
id: docker_build_monolith_release | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
ghcr.io/${{ env.GHCR_NAMESPACE }}/harmony:latest | |
ghcr.io/${{ env.GHCR_NAMESPACE }}/harmony:${{ env.RELEASE_VERSION }} | |
yggdrasil: | |
name: Yggdrasil image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get release tag & build flags | |
if: github.event_name == 'release' # Only for GitHub releases | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Containers | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Yggdrasil image | |
if: github.ref_name == 'main' || github.event_name == 'workflow_dispatch' | |
id: docker_build_monolith | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
file: Dockerfile.yggdrasil | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
ghcr.io/${{ env.GHCR_NAMESPACE }}/harmony-yggdrasil:${{ github.ref_name }} | |
- name: Build release Yggdrasil image | |
if: github.event_name == 'release' # Only for GitHub releases | |
id: docker_build_monolith_release | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
file: Dockerfile.yggdrasil | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
ghcr.io/${{ env.GHCR_NAMESPACE }}/harmony-yggdrasil:latest | |
ghcr.io/${{ env.GHCR_NAMESPACE }}/harmony-yggdrasil:${{ env.RELEASE_VERSION }} |