Skip to content

Commit

Permalink
ci: Build docker image
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Jul 24, 2024
1 parent 71539b5 commit eab69bc
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 2 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Docker image

on:
release:
types: [published]
push:
branches:
- ci/docker
- main
- master
- stable*

env:
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/whiteboard

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
platform:
- linux/amd64
- linux/arm64

steps:
- name: Set vars
id: vars
run: |
echo "version_channel=${{ github.event_name == 'release' && 'release' || 'daily' }}" >> $GITHUB_OUTPUT
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "platform=$(echo -n ${{ matrix.platform }} | sed 's/\//-/g')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

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

- name: Build docker images
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: ${{ matrix.platform }}
provenance: false
tags: |
${{ env.GHCR_REPO}}:${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.platform }}
release:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build

steps:
- name: Set vars
id: vars
run: |
echo "version=daily" >> $GITHUB_OUTPUT
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create GHCR manifest
run: |
docker manifest create $GHCR_REPO:${{ steps.vars.outputs.version }} \
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-arm64
docker manifest create $GHCR_REPO:${{ steps.vars.outputs.version_channel }} \
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-arm64
- name: Push manifests
run: |
docker manifest push $GHCR_REPO:${{ steps.vars.outputs.version }}
docker manifest push $GHCR_REPO:${{ steps.vars.outputs.version_channel }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

ARG NODE_VERSION=20.0.0
ARG NODE_VERSION=20

FROM node:${NODE_VERSION}-alpine
FROM node:${NODE_VERSION}

ENV NODE_ENV production

Expand Down

0 comments on commit eab69bc

Please sign in to comment.