Skip to content

fix: Fix correct label format #176

fix: Fix correct label format

fix: Fix correct label format #176

name: Docker
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: bakta-web-backend
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 image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Push image to github registry
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=harbor.computational.bio.uni-giessen.de/bakta/bakta-web-backend
echo VERSION=$VERSION
echo "${{ secrets.HARBOR_PW }}" | docker login harbor.computational.bio.uni-giessen.de -u '${{ secrets.HARBOR_USER }}' --password-stdin
HARBOR_IMAGE_ID=harbor.computational.bio.uni-giessen.de/bakta/bakta-web-backend
docker tag $IMAGE_NAME $HARBOR_IMAGE_ID:$VERSION
docker push $HARBOR_IMAGE_ID:$VERSION