-
Notifications
You must be signed in to change notification settings - Fork 104
94 lines (88 loc) · 3.22 KB
/
build-image.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
name: 'Composition Repo - Build Release'
on:
workflow_call:
inputs:
composition:
description: "Composition repository, e.g. hitobito/ose_composition_sjas"
type: string
required: true
source_ref:
description: "Git ref of next version, e.g. production"
type: string
required: true
project:
description: "Name of the project, e.g. sjas"
type: string
required: true
version:
description: "Version to be deployed, e.g. 1.30.5 or 1.30.5-{SHA}"
type: string
required: true
stage:
description: "Target-stage for image, used as additional tag: production or integration"
type: string
required: true
default: integration
push:
description: "Build and debug things without pushing to the registry"
type: boolean
default: true
secrets:
PUZZLE_REGISTRY:
description: 'FQDN of the registry'
required: true
PUZZLE_REGISTRY_USERNAME:
description: 'Username for the registry-robot-account'
required: true
PUZZLE_REGISTRY_PASSWORD:
description: 'Password for the registry-robot-account'
required: true
jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout composition repo'
uses: actions/checkout@v4
with:
repository: ${{ inputs.composition }}
ref: ${{ inputs.source_ref }}
submodules: true
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ secrets.PUZZLE_REGISTRY }}
username: ${{ secrets.PUZZLE_REGISTRY_USERNAME }}
password: ${{ secrets.PUZZLE_REGISTRY_PASSWORD }}
- uses: docker/build-push-action@v4
with:
context: .
file: hitobito/Dockerfile
build-args: |
BUILD_REPO=${{ inputs.composition }}
BUILD_REF=${{ inputs.source_ref }}
BUILD_COMMIT=${{ inputs.version }}
HITOBITO_PROJECT=${{ inputs.project }}
HITOBITO_STAGE=${{ inputs.stage }}
target: app
tags: |
${{ secrets.PUZZLE_REGISTRY }}/hitobito/${{ inputs.project }}/rails:latest
${{ secrets.PUZZLE_REGISTRY }}/hitobito/${{ inputs.project }}/rails:${{ inputs.version }}
${{ secrets.PUZZLE_REGISTRY }}/hitobito/${{ inputs.project }}/rails:${{ inputs.stage }}
push: ${{ inputs.push }}
- uses: docker/build-push-action@v4
with:
context: .
file: hitobito/Dockerfile
build-args: |
BUILD_REPO=${{ inputs.composition }}
BUILD_REF=${{ inputs.source_ref }}
BUILD_COMMIT=${{ inputs.version }}
HITOBITO_PROJECT=${{ inputs.project }}
HITOBITO_STAGE=${{ inputs.stage }}
target: sphinx
tags: |
${{ secrets.PUZZLE_REGISTRY }}/hitobito/${{ inputs.project }}/sphinx:latest
${{ secrets.PUZZLE_REGISTRY }}/hitobito/${{ inputs.project }}/sphinx:${{ inputs.version }}
${{ secrets.PUZZLE_REGISTRY }}/hitobito/${{ inputs.project }}/sphinx:${{ inputs.stage }}
push: ${{ inputs.push }}