Skip to content

Commit 6a3f7fd

Browse files
committed
ci: Build docker image
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 71539b5 commit 6a3f7fd

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

.github/workflows/docker.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Docker image
5+
6+
on:
7+
release:
8+
types: [published]
9+
push:
10+
branches:
11+
- ci/docker
12+
- main
13+
- master
14+
- stable*
15+
16+
env:
17+
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/whiteboard
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-22.04
22+
timeout-minutes: 30
23+
24+
strategy:
25+
matrix:
26+
platform:
27+
- linux/amd64
28+
- linux/arm64
29+
30+
steps:
31+
- name: Set vars
32+
id: vars
33+
run: |
34+
echo "version_channel=${{ github.event_name == 'release' && 'release' || 'daily' }}" >> $GITHUB_OUTPUT
35+
echo "version=${{ github.sha }}" >> $GITHUB_OUTPUT
36+
echo "platform=$(echo -n ${{ matrix.platform }} | sed 's/\//-/g')" >> $GITHUB_OUTPUT
37+
38+
- uses: actions/checkout@v3
39+
- uses: docker/setup-qemu-action@v3
40+
- uses: docker/setup-buildx-action@v3
41+
42+
- name: Login to Github Container Registry
43+
uses: docker/login-action@v2
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Build docker images
50+
uses: docker/build-push-action@v3
51+
with:
52+
context: .
53+
push: true
54+
platforms: ${{ matrix.platform }}
55+
provenance: false
56+
tags: |
57+
${{ env.GHCR_REPO}}:${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.platform }}
58+
59+
release:
60+
runs-on: ubuntu-22.04
61+
timeout-minutes: 10
62+
needs: build
63+
64+
steps:
65+
- name: Set vars
66+
id: vars
67+
run: |
68+
echo "version_channel=${{ github.event_name == 'release' && 'release' || 'daily' }}" >> $GITHUB_OUTPUT
69+
echo "version=${{ github.sha }}" >> $GITHUB_OUTPUT
70+
71+
- name: Login to Github Container Registry
72+
uses: docker/login-action@v2
73+
with:
74+
registry: ghcr.io
75+
username: ${{ github.actor }}
76+
password: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- name: Create GHCR manifest
79+
run: |
80+
docker manifest create $GHCR_REPO:${{ steps.vars.outputs.version }} \
81+
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \
82+
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-arm64
83+
84+
docker manifest create $GHCR_REPO:${{ steps.vars.outputs.version_channel }} \
85+
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \
86+
$GHCR_REPO:${{ steps.vars.outputs.version }}-linux-arm64
87+
88+
- name: Push manifests
89+
run: |
90+
docker manifest push $GHCR_REPO:${{ steps.vars.outputs.version }}
91+
docker manifest push $GHCR_REPO:${{ steps.vars.outputs.version_channel }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
22
# SPDX-License-Identifier: AGPL-3.0-or-later
33

4-
ARG NODE_VERSION=20.0.0
4+
ARG NODE_VERSION=20
55

6-
FROM node:${NODE_VERSION}-alpine
6+
FROM node:${NODE_VERSION}
77

88
ENV NODE_ENV production
99

0 commit comments

Comments
 (0)