forked from alphagov/notifications-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (50 loc) · 1.61 KB
/
docker.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Docker
on:
push:
branches: ["*"]
tags: ["*"]
env:
REGISTRY: ghcr.io
REPO: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Generate version.py before building image
run: |
echo -e "__git_commit__ = \"${{ github.sha }}\"\n__time__ = \"$(date)\"" > ./app/version.py
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Keep Docker happy
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
# This is only here because docker freaks out if the repo/tag that you're pushing to is not all lowercase
- name: Extract metadata from Git
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.REPO }}
- name: Build and push API image
id: build-admin-image
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
context: .
file: ./docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false
# TODO: add a git tag and associated docker tag for it on merge