Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ env:
REGISTRY_ALIAS: m8q5m4u3
REPOSITORY: mega
IMAGE_TAG_BASE: campsite-0.1.0-pre-release
GCP_PROJECT_ID: infra-20250121-20260121-0235
GCP_REPOSITORY: mega
RUBY_VERSION: 3.3.4
NODE_VERSION: 18.16.1
BUNDLER_VERSION: 2.3.14
Expand All @@ -20,7 +22,6 @@ concurrency:
cancel-in-progress: true

jobs:
# Build amd64 image in CI and push to ECR Public
build-push-amd64:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand All @@ -30,6 +31,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# =========================
# AWS (ECR Public)
# =========================
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand All @@ -43,21 +47,41 @@ jobs:
with:
registry-type: public

- name: Build & push amd64 image
# =========================
# GCP (Artifact Registry)
# =========================
- name: Auth to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Configure docker for GCP
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev

# =========================
# Build & Push
# =========================
- name: Build & push amd64 image (AWS + GCP)
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
AWS_REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
GCP_IMAGE_BASE: us-central1-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GCP_REPOSITORY }}/${{ env.REPOSITORY }}
run: |
set -euo pipefail
IMAGE_BASE="$REGISTRY/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}"

AWS_IMAGE_BASE="$AWS_REGISTRY/${{ env.REGISTRY_ALIAS }}/${{ env.REPOSITORY }}"
IMAGE_TAG="${{ env.IMAGE_TAG_BASE }}-amd64"

docker buildx build \
--platform linux/amd64 \
--provenance=false \
--sbom=false \
-t "$IMAGE_BASE:${{ env.IMAGE_TAG_BASE }}-amd64" \
--build-arg RUBY_VERSION=${{ env.RUBY_VERSION }} \
--build-arg NODE_VERSION=${{ env.NODE_VERSION }} \
--build-arg BUNDLER_VERSION=${{ env.BUNDLER_VERSION }} \
-f ./api/Dockerfile \
-t "$AWS_IMAGE_BASE:$IMAGE_TAG" \
-t "$GCP_IMAGE_BASE:$IMAGE_TAG" \
--push ./api

# Merge locally-built arm64 image (pushed separately) with CI-built amd64
Expand Down