-
Notifications
You must be signed in to change notification settings - Fork 38
35 lines (33 loc) · 1.07 KB
/
build_docker_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
name: Build Docker Images
on: workflow_dispatch
jobs:
build-docker:
name: Build docker images for CI
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE: "ghcr.io/nikolausdemmel/rootba/ubuntu-ci-rootba"
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker images
shell: bash
run: |
cd ci/docker
for tag in 20.04 22.04; do
# fetches the latest image for cache (not failing if image is not found)
docker pull $IMAGE:$tag || true
docker build --pull --cache-from $IMAGE:$tag -f Dockerfile_$tag -t $IMAGE:$tag .
docker push $IMAGE:$tag
done
# tag the last image as 'latest'
docker tag $IMAGE:$tag $IMAGE:latest
docker push $IMAGE:latest