From 9e546d75dcd5026bc6050e9150abaecf66906ab6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 24 Mar 2022 14:39:31 +0000 Subject: [PATCH] Upload Docker images for releases to both Docker Hub and GitHub Container Registry --- .../workflows/{docker-hub.yml => docker.yml} | 21 +++++++++++++++++-- build/docker/Dockerfile.monolith | 4 ++++ build/docker/Dockerfile.polylith | 4 ++++ 3 files changed, 27 insertions(+), 2 deletions(-) rename .github/workflows/{docker-hub.yml => docker.yml} (71%) diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker.yml similarity index 71% rename from .github/workflows/docker-hub.yml rename to .github/workflows/docker.yml index 0322866d7..ca6d860c3 100644 --- a/.github/workflows/docker-hub.yml +++ b/.github/workflows/docker.yml @@ -9,6 +9,7 @@ on: env: DOCKER_NAMESPACE: matrixdotorg DOCKER_HUB_USER: dendritegithub + GHCR_NAMESPACE: matrix-org PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 jobs: @@ -24,10 +25,16 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ env.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_TOKEN }} + - name: Login to GitHub Containers + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build monolith image id: docker_build_monolith @@ -40,6 +47,8 @@ jobs: tags: | ${{ env.DOCKER_NAMESPACE }}/dendrite-monolith:latest ${{ env.DOCKER_NAMESPACE }}/dendrite-monolith:${{ env.RELEASE_VERSION }} + ghcr.io/${{ GHCR_NAMESPACE }}/dendrite-monolith:latest + ghcr.io/${{ GHCR_NAMESPACE }}/dendrite-monolith:${{ env.RELEASE_VERSION }} Polylith: runs-on: ubuntu-latest @@ -53,10 +62,16 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ env.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_TOKEN }} + - name: Login to GitHub Containers + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build polylith image id: docker_build_polylith @@ -69,3 +84,5 @@ jobs: tags: | ${{ env.DOCKER_NAMESPACE }}/dendrite-polylith:latest ${{ env.DOCKER_NAMESPACE }}/dendrite-polylith:${{ env.RELEASE_VERSION }} + ghcr.io/${{ GHCR_NAMESPACE }}/dendrite-polylith:latest + ghcr.io/${{ GHCR_NAMESPACE }}/dendrite-polylith:${{ env.RELEASE_VERSION }} diff --git a/build/docker/Dockerfile.monolith b/build/docker/Dockerfile.monolith index 7fd25674b..0d2a141ad 100644 --- a/build/docker/Dockerfile.monolith +++ b/build/docker/Dockerfile.monolith @@ -13,6 +13,10 @@ RUN go build -trimpath -o bin/ ./cmd/create-account RUN go build -trimpath -o bin/ ./cmd/generate-keys FROM alpine:latest +LABEL org.opencontainers.image.title="Dendrite (Monolith)" +LABEL org.opencontainers.image.description="Next-generation Matrix homeserver written in Go" +LABEL org.opencontainers.image.source="https://github.com/matrix-org/dendrite" +LABEL org.opencontainers.image.licenses="Apache-2.0" COPY --from=base /build/bin/* /usr/bin/ diff --git a/build/docker/Dockerfile.polylith b/build/docker/Dockerfile.polylith index 819926c4e..c266fd480 100644 --- a/build/docker/Dockerfile.polylith +++ b/build/docker/Dockerfile.polylith @@ -13,6 +13,10 @@ RUN go build -trimpath -o bin/ ./cmd/create-account RUN go build -trimpath -o bin/ ./cmd/generate-keys FROM alpine:latest +LABEL org.opencontainers.image.title="Dendrite (Polylith)" +LABEL org.opencontainers.image.description="Next-generation Matrix homeserver written in Go" +LABEL org.opencontainers.image.source="https://github.com/matrix-org/dendrite" +LABEL org.opencontainers.image.licenses="Apache-2.0" COPY --from=base /build/bin/* /usr/bin/