Skip to content

Merge pull request #2940 from Mbaoma/improve-dockerization #1452

Merge pull request #2940 from Mbaoma/improve-dockerization

Merge pull request #2940 from Mbaoma/improve-dockerization #1452

Workflow file for this run

name: Build Docker images
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
release:
types:
- published
permissions: {}
jobs:
build:
permissions:
contents: read # to fetch code (actions/checkout)
packages: write # to push docker image
name: Build image
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
- name: Run the build
run: |
set -ex
# use that here since the variable are not present before start, so can't be in env
export LOGIN=$GITHUB_REPOSITORY_OWNER
echo $PASSWORD | docker login $REGISTRY -u $LOGIN --password-stdin
for i in docker/* ; do
CONTAINER=$(basename $i)
echo "Building $CONTAINER"
export IMAGE=$LOGIN/augur_$CONTAINER
DOCKERFILE=${i}/Dockerfile
docker build . -f $DOCKERFILE --tag $REGISTRY/$IMAGE:latest
if [[ $GITHUB_EVENT_NAME == 'release' ]]; then
TAG=$(basename $GITHUB_REF)
docker tag $REGISTRY/$IMAGE:latest $REGISTRY/$IMAGE:$TAG
docker push $REGISTRY/$IMAGE:latest
docker push $REGISTRY/$IMAGE:$TAG
elif [[ $GITHUB_EVENT_NAME == 'push' ]]; then
docker tag $REGISTRY/$IMAGE:latest $REGISTRY/$IMAGE:devel-latest
docker push $REGISTRY/$IMAGE:devel-latest
fi
done
env:
REGISTRY: ghcr.io
PASSWORD: ${{ secrets.GITHUB_TOKEN }}