Skip to content

Build-and-publish-docker-images-workflow #38

Build-and-publish-docker-images-workflow

Build-and-publish-docker-images-workflow #38

name: Build-and-publish-docker-images-workflow
on:
push:
branches:
- main
- staging
- development
release:
types: [published]
jobs:
Build-and-publish-docker-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set environment for branch
run: |
if [[ "${{github.base_ref}}" == "main" || "${{github.ref}}" == "refs/heads/main" ]]; then
echo "IMAGE_TAG=latest" >> "$GITHUB_ENV"
elif [[ "${{github.base_ref}}" == "staging" || "${{github.ref}}" == "refs/heads/staging" ]]; then
echo "IMAGE_TAG=staging" >> "$GITHUB_ENV"
else
echo "IMAGE_TAG=unstable" >> "$GITHUB_ENV"
fi
- name: Build and push All in One image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile
context: .
push: true
tags: fraunhoferiosb/aasportal_aio:${{env.IMAGE_TAG}}
- name: Build and push AASPortal (frontend) image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.aas-portal
context: .
push: true
tags: fraunhoferiosb/aasportal_aasportal:${{env.IMAGE_TAG}}
- name: Build and push AASServer (backend) image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.aas-server
context: .
push: true
tags: fraunhoferiosb/aasportal_aasserver:${{env.IMAGE_TAG}}