-
Notifications
You must be signed in to change notification settings - Fork 5
55 lines (49 loc) · 1.63 KB
/
build_base.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
name: Build and push image
on:
workflow_call:
inputs:
image:
required: true
type: string
context:
required: true
type: string
target:
required: false
type: string
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@v3
- 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.context }}
target: ${{ inputs.target }}
file: ${{ inputs.context }}/Dockerfile
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 }}