-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (68 loc) · 2.25 KB
/
build-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
on:
workflow_call:
inputs:
environment:
required: false
description: Used by Skaffold and Helmfile profiles
type: string
default: staging
env-template:
required: false
description: Env template file
type: string
default: staging
version:
required: false
description: Env template file
type: string
default: latest
jobs:
docker:
runs-on: self-hosted
concurrency:
group: ${{ github.event.repository.name }}-docker-${{ github.ref_name }}
cancel-in-progress: true
env:
APP_NAME: ${{ github.event.repository.name }}
APP_ENV: ${{ inputs.environment }}
APP_VERSION: ${{ inputs.version }}
BUILDKIT_PROGRESS: plain
DOCKER_REPOSITORY: dcr.bndigital.dev/${{ github.event.repository.name }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_IMAGE: app
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Generate cms .env files
uses: bn-digital/vault-env@latest
continue-on-error: true
with:
endpoint: ${{ secrets.VAULT_ENDPOINT }}
token: ${{ secrets.GH_TOKEN }}
template: packages/cms/.env.${{ env.APP_ENV }}
target: packages/cms/.env
- name: Generate website .env files
uses: bn-digital/vault-env@latest
continue-on-error: true
with:
endpoint: ${{ secrets.VAULT_ENDPOINT }}
token: ${{ secrets.GH_TOKEN }}
template: packages/website/.env.${{ inputs.env-template }}
target: packages/website/.env.production
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Login Docker registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REPOSITORY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.DOCKER_REPOSITORY }}/${{ env.DOCKER_IMAGE }}:${{ env.APP_VERSION }}