-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (36 loc) · 1.12 KB
/
containers.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
name: Build and publish containers
on:
push:
paths:
- docker/**
jobs:
build-containers:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build containers
run: |
for file in *.Dockerfile
do
IMAGE=${file%.*}
docker build --file $file --tag $IMAGE --label "github_run_id=${GITHUB_RUN_ID}" .
done
working-directory: docker
- name: Publish containers
run: |
BRANCH=${GITHUB_REF##*/}
for file in *.Dockerfile
do
IMAGE=${file%.*}
VERSION=$(docker inspect --format='{{ index .Config.Labels "version" }}' $IMAGE)
docker tag $IMAGE ghcr.io/linz/$IMAGE:$VERSION
docker push ghcr.io/linz/$IMAGE:$VERSION
docker tag $IMAGE ghcr.io/linz/$IMAGE:latest
docker push ghcr.io/linz/$IMAGE:latest
done
working-directory: docker