api-client/.github/workflows/release-push-docker.yml
2025-03-13 01:44:52 +05:30

121 lines
4.5 KiB
YAML

name: "Push containers to Docker Hub on release"
on:
push:
tags:
- '*.*.*'
workflow_dispatch:
inputs:
# NO INPUTS
jobs:
build:
# strategy:
# matrix:
# platform: [
# { platform: linux/amd64, cache: docker-release-amd64 },
# { platform: linux/arm64, cache: docker-release-arm64 },
# ]
runs-on: ubuntu-latest
# continue-on-error: true # We can continue each platform deployment if the other fails
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup environment
run: cp .env.example .env
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push the backend container
uses: docker/build-push-action@v4
if: false # TODO: Temporary, remove later
with:
context: .
file: ./prod.Dockerfile
target: backend
push: true
# cache-from: type=gha,timeout=200m,scope=${{ matrix.platform.cache }}
# cache-to: type=gha,mode=max,timeout=200m,scope=${{ matrix.platform.cache }}
cache-from: type=gha,timeout=200m,scope=docker-release-allarch
cache-to: type=gha,mode=max,timeout=200m,scope=docker-release-allarch
# platforms: |
# ${{ matrix.platform.platform }}
platforms: |
linux/amd64
linux/arm64
tags: |
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_BACKEND_CONTAINER_NAME }}:latest
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_BACKEND_CONTAINER_NAME }}:${{ github.ref_name }}
- name: Build and push the frontend container
uses: docker/build-push-action@v4
if: false # TODO: Temporary, remove later
with:
context: .
file: ./prod.Dockerfile
target: app
push: true
# cache-from: type=gha,timeout=200m,scope=${{ matrix.platform.cache }}
# cache-to: type=gha,mode=max,timeout=200m,scope=${{ matrix.platform.cache }}
cache-from: type=gha,timeout=200m,scope=docker-release-allarch
cache-to: type=gha,mode=max,timeout=200m,scope=docker-release-allarch
# platforms: |
# ${{ matrix.platform.platform }}
platforms: |
linux/amd64
linux/arm64
tags: |
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_FRONTEND_CONTAINER_NAME }}:latest
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_FRONTEND_CONTAINER_NAME }}:${{ github.ref_name }}
- name: Build and push the admin dashboard container
uses: docker/build-push-action@v4
with:
context: .
file: ./prod.Dockerfile
target: sh_admin
push: true
# cache-from: type=gha,timeout=200m,scope=${{ matrix.platform.cache }}
# cache-to: type=gha,mode=max,timeout=200m,scope=${{ matrix.platform.cache }}
cache-from: type=gha,timeout=200m,scope=docker-release-allarch
cache-to: type=gha,mode=max,timeout=200m,scope=docker-release-allarch
# platforms: |
# ${{ matrix.platform.platform }}
platforms: |
linux/amd64
linux/arm64
tags: |
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_SH_ADMIN_CONTAINER_NAME }}:latest
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_SH_ADMIN_CONTAINER_NAME }}:${{ github.ref_name }}
- name: Build and push the AIO container
uses: docker/build-push-action@v4
with:
context: .
file: ./prod.Dockerfile
target: aio
push: true
# cache-from: type=gha,timeout=200m,scope=${{ matrix.platform.cache }}
# cache-to: type=gha,mode=max,timeout=200m,scope=${{ matrix.platform.cache }}
cache-from: type=gha,timeout=200m,scope=docker-release-allarch
cache-to: type=gha,mode=max,timeout=200m,scope=docker-release-allarch
# platforms: |
# ${{ matrix.platform.platform }}
platforms: |
linux/amd64
linux/arm64
tags: |
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_AIO_CONTAINER_NAME }}:latest
${{ secrets.DOCKER_ORG_NAME }}/${{ secrets.DOCKER_AIO_CONTAINER_NAME }}:${{ github.ref_name }}