From 75e89f5bf830892023e05bb31bfae1b2561d794c Mon Sep 17 00:00:00 2001 From: Groom Book CEO Date: Tue, 17 Mar 2026 23:46:29 +0000 Subject: [PATCH] Add seed Docker stage and push migrate/seed images in CI - Add seed stage to API Dockerfile (FROM builder, runs pnpm db:seed) - Add explicit target: runner to API image build (prevents building wrong stage) - Add CI steps to push ghcr.io/groombook/migrate and ghcr.io/groombook/seed images Co-Authored-By: Paperclip --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ apps/api/Dockerfile | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ae12ef..7b84615 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,6 +94,7 @@ jobs: with: context: . file: apps/api/Dockerfile + target: runner push: true tags: | ghcr.io/groombook/api:${{ github.sha }} @@ -101,6 +102,32 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max + - name: Build and push Migrate image + uses: docker/build-push-action@v6 + with: + context: . + file: apps/api/Dockerfile + target: migrate + push: true + tags: | + ghcr.io/groombook/migrate:${{ github.sha }} + ghcr.io/groombook/migrate:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push Seed image + uses: docker/build-push-action@v6 + with: + context: . + file: apps/api/Dockerfile + target: seed + push: true + tags: | + ghcr.io/groombook/seed:${{ github.sha }} + ghcr.io/groombook/seed:latest + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Build and push Web image uses: docker/build-push-action@v6 with: diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 6d8d03d..4fbcb3f 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -38,3 +38,7 @@ CMD ["node", "apps/api/dist/index.js"] # Migrate stage — runs drizzle-kit migrate against the database FROM builder AS migrate CMD ["pnpm", "db:migrate"] + +# Seed stage — populates the database with test data +FROM builder AS seed +CMD ["pnpm", "db:seed"] -- 2.52.0