-
Notifications
You must be signed in to change notification settings - Fork 5
66 lines (59 loc) · 1.9 KB
/
build.yaml
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
name: Build and push image
on:
workflow_call:
inputs:
image:
required: true
type: string
context:
required: true
type: string
target:
required: false
default: ''
type: string
withLibs:
required: false
default: false
type: boolean
env:
COMPOSE_PROJECT_NAME: build
REGISTRY_NAMESPACE: ghcr.io/${{ github.repository_owner }}/ps-
DOCKER_TAG: ${{ github.sha }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'alchemy-fr' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 30
- name: Generate git log
if: "${{ inputs.image == 'dashboard' }}"
run: bin/git-log.sh
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: ${{ inputs.withLibs && './' || inputs.context }}
file: ${{ inputs.context }}/Dockerfile
target: ${{ inputs.target }}
provenance: false
push: true
cache-from: type=registry,ref=${{ env.REGISTRY_NAMESPACE }}${{ inputs.image }}:build-cache
cache-to: type=registry,mode=max,ref=${{ env.REGISTRY_NAMESPACE }}${{ inputs.image }}:build-cache
build-args: |
BASE_TAG=${{ env.DOCKER_TAG }}
REGISTRY_NAMESPACE=${{ env.REGISTRY_NAMESPACE }}
SENTRY_RELEASE=${{ github.sha }}
tags: |
${{ env.REGISTRY_NAMESPACE }}${{ inputs.image }}:${{ env.DOCKER_TAG }}