Build Docker (manually) #69
Workflow file for this run
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: Build Docker (manually) | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
imageTag: | |
description: 'The tag to be used for the images' | |
required: true | |
default: 'latest' | |
env: | |
IMAGE_NAME_BASE: seerep_base | |
IMAGE_NAME_SERVER: seerep_server | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build-docker: | |
runs-on: ubuntu-20.04 | |
permissions: | |
packages: write | |
steps: | |
- | |
name: Generate tags base | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME_BASE | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# save to env for later steps | |
echo "image_id_base=$IMAGE_ID" >> $GITHUB_ENV | |
- | |
name: Generate tags server | |
run: | | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME_SERVER | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# save to env for later steps | |
echo "image_id_server=$IMAGE_ID" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and Push Base Image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
file: Dockerfile | |
context: "{{defaultContext}}:docker/base" | |
platforms: linux/amd64, linux/arm64 | |
tags: ${{ env.image_id_base }}:${{ github.event.inputs.imageTag }} | |
cache-from: type=registry,ref=${{ env.image_id_base }}:${{ github.event.inputs.imageTag }} | |
cache-to: type=inline | |
- | |
name: Build and Push Server Image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
file: docker/server/Dockerfile | |
platforms: linux/amd64, linux/arm64 | |
tags: ${{ env.image_id_server }}:${{ github.event.inputs.imageTag }} | |
cache-from: type=registry,ref=${{ env.image_id_server }}:${{ github.event.inputs.imageTag }} | |
cache-to: type=inline | |
build-args: | | |
IMAGEBASE=${{ env.image_id_base }} | |
IMAGEBASETAG=${{ github.event.inputs.imageTag }} |