Skip to content

bugfix [#61]: handling for not received schedules and business type s… #183

bugfix [#61]: handling for not received schedules and business type s…

bugfix [#61]: handling for not received schedules and business type s… #183

name: Build and Publish Docker Image
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
build-model-retriever:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Set multiple environment variables
- name: Set Docker image tag and other variables
run: |
echo "WORKER_NAME=emfos-model-retriever" >> $GITHUB_ENV
echo "BRANCH_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "IMAGE_TAG=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
echo "LATEST_TAG=latest" >> $GITHUB_ENV
# Print env variables
- name: Print environment variables
run: env
# Construct image name
- name: Construct and output IMAGE_NAME
run: |
IMAGE_NAME="${{ vars.DOCKER_USERNAME }}/${WORKER_NAME}"
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
# Build the Docker image
- name: Build the Docker image
run: |
docker build . --file docker/Dockerfile --target ${{ env.WORKER_NAME }} --tag ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }}
docker tag ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }} ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.LATEST_TAG }}
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Push the Docker image to Docker Hub
- name: Push Docker image to Docker Hub with date-based tag
run: docker push ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }}
- name: Push Docker image to Docker Hub with "latest" tag
run: docker push ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.LATEST_TAG }}
- name: Image details
run: |
echo "Image ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }}} pushed to Docker Hub"
echo "Image ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.LATEST_TAG }} pushed to Docker Hub"
build-model-merger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Set multiple environment variables
- name: Set Docker image tag and other variables
run: |
echo "WORKER_NAME=emfos-model-merger" >> $GITHUB_ENV
echo "BRANCH_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV
echo "IMAGE_TAG=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
echo "LATEST_TAG=latest" >> $GITHUB_ENV
# Print env variables
- name: Print environment variables
run: env
# Construct image name
- name: Construct and output IMAGE_NAME
run: |
IMAGE_NAME="${{ vars.DOCKER_USERNAME }}/${WORKER_NAME}"
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
# Build the Docker image
- name: Build the Docker image
run: |
docker build . --file docker/Dockerfile --target ${{ env.WORKER_NAME }} --tag ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }}
docker tag ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }} ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.LATEST_TAG }}
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Push the Docker image to Docker Hub
- name: Push Docker image to Docker Hub with date-based tag
run: docker push ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }}
- name: Push Docker image to Docker Hub with "latest" tag
run: docker push ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.LATEST_TAG }}
- name: Image details
run: |
echo "Image ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.IMAGE_TAG }}} pushed to Docker Hub"
echo "Image ${{ env.IMAGE_NAME }}:${{ env.BRANCH_NAME }}-${{ env.LATEST_TAG }} pushed to Docker Hub"