-
Notifications
You must be signed in to change notification settings - Fork 19
53 lines (40 loc) · 1.46 KB
/
docker-publish.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
name: Publish Docker image
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
workflow_dispatch:
# Allow manually triggered builds too.
env:
PYTHON_IMAGE_NAME: python-backend
JAVA_IMAGE_NAME: java-backend
PYTHON_ALERTS_IMAGE_NAME: python-alerts-backend
AEROAPI_KEY: dummy
AEROAPPS_VERSION: latest
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Build images
run: |
# Strip git ref prefix from version
AEROAPPS_VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Use Docker `latest` tag convention
[ "$AEROAPPS_VERSION" == "main" ] && AEROAPPS_VERSION=latest
echo "AEROAPPS_VERSION=$AEROAPPS_VERSION" >> $GITHUB_ENV
docker-compose build --parallel $JAVA_IMAGE_NAME $PYTHON_IMAGE_NAME
docker-compose -f docker-compose-alerts.yml build $PYTHON_ALERTS_IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ secrets.GHCR_USER }} --password-stdin
- name: Push images
run: |
docker-compose push $JAVA_IMAGE_NAME $PYTHON_IMAGE_NAME
docker-compose -f docker-compose-alerts.yml push $PYTHON_ALERTS_IMAGE_NAME