Files
Draupnir/.github/workflows/docker-hub-release.yml
Gnuxie b13b6150e5 Use multi-stage build in Dockerfile (#595)
* Use multi-stage build in Dockerfile

https://github.com/the-draupnir-project/Draupnir/issues/300.

* Move git describe and build into one stage.

Probably won't be a good idea to download an alpine image just to install git.

* Remove git describe step from CI.

* whoopsie, copy version from the build stage not the deleted stamp.
2024-10-10 09:35:23 +01:00

60 lines
1.6 KiB
YAML

# SPDX-FileCopyrightText: 2024 Gnuxie <Gnuxie@protonmail.com>
#
# SPDX-License-Identifier: CC0-1.0
# Copied from https://github.com/matrix-org/matrix-bifrost/blob/develop/.github/workflows/docker-hub-release.yml
# This is duplicated with docker-hub-latest.yml the only difference is the tag and hook
name: "Docker Hub - Release"
on:
release:
types: [published]
env:
DOCKER_NAMESPACE: gnuxie
PLATFORMS: linux/amd64,linux/arm64
jobs:
docker-release:
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
attestations: write
steps:
- name: Check out
uses: actions/checkout@v4
- name: Get release tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Unshallow for git describe so we can create version.txt
run: git fetch --prune --unshallow --tags --all --force
# Needed for multi platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
sbom: true
tags: |
${{ env.DOCKER_NAMESPACE }}/draupnir:${{ env.RELEASE_VERSION }}