-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (91 loc) · 3.27 KB
/
build-ubuntuusers-docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Inyoka - Build docker images
# how to schedule it manually
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
on:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
workflow_dispatch:
inputs:
branch:
description: 'Which branch to build container for'
required: true
type: choice
options:
- staging
- master
- testing
env:
REGISTRY: git.ubuntu-eu.org
jobs:
build-and-push-image:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout inyoka docker repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Checkout inyoka repo
uses: actions/checkout@v4
with:
repository: inyokaproject/inyoka
ref: ${{ inputs.branch }}
path: inyoka
persist-credentials: false
fetch-depth: 0
- name: Checkout theme repo
uses: actions/checkout@v4
with:
repository: inyokaproject/theme-ubuntuusers
ref: ${{ inputs.branch }}
path: theme
persist-credentials: false
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# network=host driver-opt needed to push to local registry
driver-opts: network=host
- name: Get inyoka version string
run: echo "INYOKA_VERSION=$(git -C inyoka/ describe --tags)--theme-ubuntuusers$(git -C theme/ describe --tags)" >> $GITHUB_ENV
- name: Get inyoka tag (master branch)
if: ${{ inputs.branch == 'master' }}
run: echo "INYOKA_TAG=latest" >> $GITHUB_ENV
- name: Get inyoka tag (other branches)
if: ${{ inputs.branch != 'master' }}
run: echo "INYOKA_TAG=${{ inputs.branch }}" >> $GITHUB_ENV
- name: Log in to own container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Build Inyoka image and push to own container registry
uses: docker/build-push-action@v5
id: docker_build_inyoka
with:
context: .
tags: |
${{ env.REGISTRY }}/ubuntuusers/inyokaproject:${{ env.INYOKA_VERSION }}
${{ env.REGISTRY }}/ubuntuusers/inyokaproject:${{ env.INYOKA_TAG }}
localhost:5000/inyokaproject:${{ env.INYOKA_VERSION }}
target: inyoka_custom_theme
push: true
- name: Build customized caddy image and push to own container registry
uses: docker/build-push-action@v5
id: docker_build_caddy
with:
context: .
tags: |
${{ env.REGISTRY }}/ubuntuusers/caddy-inyoka:${{ env.INYOKA_VERSION }}
${{ env.REGISTRY }}/ubuntuusers/caddy-inyoka:${{ env.INYOKA_TAG }}
file: Dockerfile_caddy
push: true
build-contexts: git.ubuntu-eu.org/ubuntuusers/inyokaproject=docker-image://localhost:5000/inyokaproject:${{ env.INYOKA_VERSION }}
- name: Image digests
run: |
echo "Inyoka: ${{ steps.docker_build_inyoka.outputs.digest }}"
echo "Caddy: ${{ steps.docker_build_caddy.outputs.digest }}"