diff --git a/.github/workflows/docker-publish-main-bc.yml b/.github/workflows/docker-publish-main-bc.yml new file mode 100644 index 0000000000..1180ddb6b4 --- /dev/null +++ b/.github/workflows/docker-publish-main-bc.yml @@ -0,0 +1,73 @@ +name: Publish Docker images (main-bc) + +# Builds and pushes the frontend (apps/OpenSign) and backend (apps/OpenSignServer) +# Docker images to GitHub Container Registry whenever main-bc is updated. +# DigitalOcean App Platform is configured to redeploy automatically when a new +# image tag is pushed (see deployment docs for the App Spec changes required). + +on: + push: + branches: + - main-bc + +permissions: + contents: read + packages: write + +env: + REGISTRY: ghcr.io + IMAGE_OWNER: bycoderstec + +jobs: + docker: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: opensign + dockerfile: apps/OpenSign/Dockerhubfile + - name: opensignserver + dockerfile: apps/OpenSignServer/Dockerhubfile + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Enable emulation so we can build for arm64 on amd64 runners + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/amd64,linux/arm64 + + # Enable Buildx for multi-arch builds and cache support + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }} + tags: | + type=raw,value=main-bc + type=raw,value=latest + type=sha,prefix=,format=short + + - name: Build and push (multi-arch) + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ matrix.dockerfile }} + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha,scope=${{ matrix.name }} + cache-to: type=gha,mode=max,scope=${{ matrix.name }}