-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (43 loc) · 1.39 KB
/
base-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
name: Base image build
on:
push:
tags:
- 'v*'
branches:
- main
pull_request:
jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
image:
- { dir: base, name: lnls-debian-11-epics-7 }
- { dir: base/musl, name: lnls-alpine-3.18-epics-7 }
env:
TAG: ${{ github.event_name == 'push' && github.ref_name || github.head_ref }}
REGISTRY: ghcr.io/${{ github.repository_owner }}
IMAGE: ${{ matrix.image.name }}
SOURCE: https://github.com/${{ github.repository }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Log in to registry
if: github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push tagged image
uses: docker/bake-action@v4
with:
workdir: ${{ matrix.image.dir }}
files: docker-compose.yml
set: |
*.cache-from=type=gha,scope=${{ matrix.image.name }}
*.cache-to=type=gha,mode=max,scope=${{ matrix.image.name }}
push: ${{ github.event_name == 'push' && vars.PUSH_TO_REGISTRY == 'true' && github.ref_type == 'tag' }}