Docker Image Build #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image Build | |
on: | |
workflow_dispatch: | |
inputs: | |
image_version: | |
description: 'The version of the Docker image' | |
required: true | |
scope: | |
description: 'Beta/Release ?' | |
type: choice | |
options: | |
- 'BETA' | |
- 'RELEASE' | |
required: true | |
jobs: | |
build-api: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Building the API Docker image | |
run: | | |
if [ "${{ inputs.scope }}" = "BETA" ]; then | |
docker build ./api/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest-beta | |
else | |
docker build ./api/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest | |
fi | |
build-client: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Building the client Docker image | |
run: | | |
if [ "${{ inputs.scope }}" = "BETA" ]; then | |
docker build ./client/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest-beta | |
else | |
docker build ./client/ --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }} --tag ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest | |
fi | |
push-images: | |
needs: [ build-api, build-client ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Push the Docker images to the ghcr.io registry | |
run: | | |
docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.GITHUB_TOKEN }} | |
if [ "${{ inputs.scope }}" = "BETA" ]; then | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest-beta | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }} | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest-beta | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }} | |
else | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:latest | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-client:${{ inputs.image_version }} | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:latest | |
docker push ghcr.io/${{ secrets.DOCKER_USERNAME }}/snoopy-api:${{ inputs.image_version }} | |
fi |