Skip to content

Commit a532792

Browse files
authored
Merge pull request #1 from flightaware/add_github_worflow
Add workflow for container build and push
2 parents 99e353c + 86c709f commit a532792

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
# Publish `main` as Docker `latest` image.
6+
branches:
7+
- main
8+
9+
# Publish `v1.2.3` tags as releases.
10+
tags:
11+
- v*
12+
13+
workflow_dispatch:
14+
# Allow manually triggered builds too.
15+
16+
env:
17+
PYTHON_IMAGE_NAME: python-backend
18+
JAVA_IMAGE_NAME: java-backend
19+
AEROAPPS_VERSION: latest
20+
21+
jobs:
22+
# Push image to GitHub Packages.
23+
# See also https://docs.docker.com/docker-hub/builds/
24+
push:
25+
26+
runs-on: ubuntu-latest
27+
if: github.event_name == 'push'
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Build images
33+
run: |
34+
# Strip git ref prefix from version
35+
AEROAPPS_VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
36+
37+
# Use Docker `latest` tag convention
38+
[ "$AEROAPPS_VERSION" == "main" ] && AEROAPPS_VERSION=latest
39+
40+
echo "AEROAPPS_VERSION=$AEROAPPS_VERSION" >> $GITHUB_ENV
41+
42+
docker-compose build --parallel $JAVA_IMAGE_NAME $PYTHON_IMAGE_NAME
43+
44+
- name: Log into registry
45+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ secrets.GHCR_USER }} --password-stdin
46+
47+
- name: Push images
48+
run:
49+
docker-compose push $JAVA_IMAGE_NAME $PYTHON_IMAGE_NAME

0 commit comments

Comments
 (0)