Skip to content

Docker

Docker #2768

Workflow file for this run

name: Docker
on:
push:
branches:
schedule:
- cron: '0 7 */2 * *'
env:
IMAGE_NAME: ghcr.io/genspectrum/cov-spectrum-website
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set environment variable "BRANCH"
run: |
echo "BRANCH=$(eval 'echo $GITHUB_REF | sed s/refs\\/heads\\/// | sed s/\\//__/g ')" >> $GITHUB_ENV
- name: Build image
run: docker build --build-arg REACT_APP_LAPIS_ACCESS_KEY=${{ secrets.REACT_APP_LAPIS_ACCESS_KEY }} -t new_image .
- name: Login to Github Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Add tags and push
if: ${{ !contains(env.BRANCH, 'dependabot') }}
run: |
docker tag new_image ${{ env.IMAGE_NAME }}:br-${{ env.BRANCH }}
docker push ${{ env.IMAGE_NAME }}:br-${{ env.BRANCH }}
- name: Add "develop" tag and push
if: env.BRANCH == 'develop'
run: |
docker tag new_image ${{ env.IMAGE_NAME }}:develop
docker push ${{ env.IMAGE_NAME }}:develop
- name: Add "public" tag and push
if: env.BRANCH == 'public'
run: |
docker tag new_image ${{ env.IMAGE_NAME }}:public
docker push ${{ env.IMAGE_NAME }}:public