From e3021417874b6c6c25b58d1f2d754cdda1000fdb Mon Sep 17 00:00:00 2001 From: Aditya Balwani Date: Sat, 16 May 2026 19:49:12 -0400 Subject: [PATCH 1/4] ci: publish Docker images to GHCR on main and releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a docker-publish workflow that builds and pushes backend and frontend images to GitHub Container Registry on every push to main and on published releases. Images are tagged with `latest`, semver (on release), and a short SHA. Update docker-compose.yml and docker-compose.prod.yml to pull pre-built images from GHCR instead of building locally, so deployments (e.g. Unraid) only need docker compose pull + up. The dev compose is unchanged — frontend still builds from Dockerfile.dev and backend/worker mount local code for hot-reload. Scope the GHA layer cache in ci.yml so the CI docker-build job and the publish workflow share cache keys without colliding. --- .github/workflows/ci.yml | 8 ++-- .github/workflows/docker-publish.yml | 67 ++++++++++++++++++++++++++++ docker-compose.prod.yml | 14 ++---- docker-compose.yml | 12 ++--- 4 files changed, 77 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0cef2d..f2e8f46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,8 +204,8 @@ jobs: context: ./backend push: false tags: wardrowbe/backend:test - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=backend + cache-to: type=gha,mode=max,scope=backend - name: Build frontend image uses: docker/build-push-action@v7 @@ -213,5 +213,5 @@ jobs: context: ./frontend push: false tags: wardrowbe/frontend:test - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=frontend + cache-to: type=gha,mode=max,scope=frontend diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..948fcc5 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,67 @@ +name: Docker Publish + +on: + push: + branches: [main] + release: + types: [published] + +permissions: + contents: read + packages: write + +jobs: + publish: + name: Publish ${{ matrix.service }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - service: backend + context: ./backend + image: wardrowbe-backend + build_args: "" + - service: frontend + context: ./frontend + image: wardrowbe-frontend + build_args: "" + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=sha,prefix=sha-,format=short + + - name: Build and push + uses: docker/build-push-action@v7 + with: + context: ${{ matrix.context }} + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: ${{ matrix.build_args }} + cache-from: type=gha,scope=${{ matrix.service }} + cache-to: type=gha,mode=max,scope=${{ matrix.service }} diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index f186ffd..e4ee02d 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -38,9 +38,7 @@ services: # FastAPI Backend backend: - build: - context: ./backend - dockerfile: Dockerfile + image: ghcr.io/anyesh/wardrowbe-backend:latest container_name: wardrobe_backend restart: unless-stopped extra_hosts: @@ -91,9 +89,7 @@ services: # arq Worker for background jobs worker: - build: - context: ./backend - dockerfile: Dockerfile + image: ghcr.io/anyesh/wardrowbe-backend:latest container_name: wardrobe_worker restart: unless-stopped command: arq app.workers.worker.WorkerSettings @@ -130,11 +126,7 @@ services: # Next.js Frontend frontend: - build: - context: ./frontend - dockerfile: Dockerfile - args: - NEXT_PUBLIC_API_URL: "" + image: ghcr.io/anyesh/wardrowbe-frontend:latest container_name: wardrobe_frontend restart: unless-stopped extra_hosts: diff --git a/docker-compose.yml b/docker-compose.yml index 2525bf5..f96908c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,9 +35,7 @@ services: # FastAPI Backend backend: - build: - context: ./backend - dockerfile: Dockerfile + image: ghcr.io/anyesh/wardrowbe-backend:latest container_name: wardrobe-backend extra_hosts: - "host.docker.internal:host-gateway" @@ -78,9 +76,7 @@ services: # Next.js Frontend frontend: - build: - context: ./frontend - dockerfile: Dockerfile + image: ghcr.io/anyesh/wardrowbe-frontend:latest container_name: wardrobe-frontend environment: NEXT_PUBLIC_API_URL: http://backend:8000 @@ -95,9 +91,7 @@ services: # Background Worker for AI Tagging worker: - build: - context: ./backend - dockerfile: Dockerfile + image: ghcr.io/anyesh/wardrowbe-backend:latest container_name: wardrobe-worker command: arq app.workers.worker.WorkerSettings extra_hosts: From 5aa30917b1445c2fef1424dfb19cbdd8793e5312 Mon Sep 17 00:00:00 2001 From: Aditya Balwani Date: Sat, 16 May 2026 19:54:57 -0400 Subject: [PATCH 2/4] ci: align publish workflow and image tags with adios pattern --- .github/workflows/docker-publish.yml | 43 +++++++++++----------------- docker-compose.prod.yml | 6 ++-- docker-compose.yml | 6 ++-- 3 files changed, 22 insertions(+), 33 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 948fcc5..8ed0c87 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,62 +6,51 @@ on: release: types: [published] -permissions: - contents: read - packages: write +env: + GHCR_REGISTRY: ghcr.io jobs: publish: name: Publish ${{ matrix.service }} runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: fail-fast: false matrix: include: - service: backend context: ./backend - image: wardrowbe-backend - build_args: "" + tag_prefix: backend - service: frontend context: ./frontend - image: wardrowbe-frontend - build_args: "" + tag_prefix: frontend steps: - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - - name: Log in to GitHub Container Registry + - name: Lowercase image name + run: echo "GHCR_IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + + - name: Login to GHCR uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.GHCR_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=sha,prefix=sha-,format=short - - name: Build and push uses: docker/build-push-action@v7 with: context: ${{ matrix.context }} push: true - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: ${{ matrix.build_args }} + tags: | + ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${{ matrix.tag_prefix }}-latest + ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${{ matrix.tag_prefix }}-${{ github.sha }} cache-from: type=gha,scope=${{ matrix.service }} cache-to: type=gha,mode=max,scope=${{ matrix.service }} diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index e4ee02d..7980365 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -38,7 +38,7 @@ services: # FastAPI Backend backend: - image: ghcr.io/anyesh/wardrowbe-backend:latest + image: ghcr.io/sirkitboard/wardrowbe:backend-latest container_name: wardrobe_backend restart: unless-stopped extra_hosts: @@ -89,7 +89,7 @@ services: # arq Worker for background jobs worker: - image: ghcr.io/anyesh/wardrowbe-backend:latest + image: ghcr.io/sirkitboard/wardrowbe:backend-latest container_name: wardrobe_worker restart: unless-stopped command: arq app.workers.worker.WorkerSettings @@ -126,7 +126,7 @@ services: # Next.js Frontend frontend: - image: ghcr.io/anyesh/wardrowbe-frontend:latest + image: ghcr.io/sirkitboard/wardrowbe:frontend-latest container_name: wardrobe_frontend restart: unless-stopped extra_hosts: diff --git a/docker-compose.yml b/docker-compose.yml index f96908c..465abca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: # FastAPI Backend backend: - image: ghcr.io/anyesh/wardrowbe-backend:latest + image: ghcr.io/sirkitboard/wardrowbe:backend-latest container_name: wardrobe-backend extra_hosts: - "host.docker.internal:host-gateway" @@ -76,7 +76,7 @@ services: # Next.js Frontend frontend: - image: ghcr.io/anyesh/wardrowbe-frontend:latest + image: ghcr.io/sirkitboard/wardrowbe:frontend-latest container_name: wardrobe-frontend environment: NEXT_PUBLIC_API_URL: http://backend:8000 @@ -91,7 +91,7 @@ services: # Background Worker for AI Tagging worker: - image: ghcr.io/anyesh/wardrowbe-backend:latest + image: ghcr.io/sirkitboard/wardrowbe:backend-latest container_name: wardrobe-worker command: arq app.workers.worker.WorkerSettings extra_hosts: From d3f737bc9eba7be48a5477fdfeba6919b405c74e Mon Sep 17 00:00:00 2001 From: Aditya Balwani Date: Sat, 16 May 2026 20:37:17 -0400 Subject: [PATCH 3/4] ci: use upstream anyesh image references for PR --- docker-compose.prod.yml | 6 +++--- docker-compose.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 7980365..0662633 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -38,7 +38,7 @@ services: # FastAPI Backend backend: - image: ghcr.io/sirkitboard/wardrowbe:backend-latest + image: ghcr.io/anyesh/wardrowbe:backend-latest container_name: wardrobe_backend restart: unless-stopped extra_hosts: @@ -89,7 +89,7 @@ services: # arq Worker for background jobs worker: - image: ghcr.io/sirkitboard/wardrowbe:backend-latest + image: ghcr.io/anyesh/wardrowbe:backend-latest container_name: wardrobe_worker restart: unless-stopped command: arq app.workers.worker.WorkerSettings @@ -126,7 +126,7 @@ services: # Next.js Frontend frontend: - image: ghcr.io/sirkitboard/wardrowbe:frontend-latest + image: ghcr.io/anyesh/wardrowbe:frontend-latest container_name: wardrobe_frontend restart: unless-stopped extra_hosts: diff --git a/docker-compose.yml b/docker-compose.yml index 465abca..b9628b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: # FastAPI Backend backend: - image: ghcr.io/sirkitboard/wardrowbe:backend-latest + image: ghcr.io/anyesh/wardrowbe:backend-latest container_name: wardrobe-backend extra_hosts: - "host.docker.internal:host-gateway" @@ -76,7 +76,7 @@ services: # Next.js Frontend frontend: - image: ghcr.io/sirkitboard/wardrowbe:frontend-latest + image: ghcr.io/anyesh/wardrowbe:frontend-latest container_name: wardrobe-frontend environment: NEXT_PUBLIC_API_URL: http://backend:8000 @@ -91,7 +91,7 @@ services: # Background Worker for AI Tagging worker: - image: ghcr.io/sirkitboard/wardrowbe:backend-latest + image: ghcr.io/anyesh/wardrowbe:backend-latest container_name: wardrobe-worker command: arq app.workers.worker.WorkerSettings extra_hosts: From b5a84f4f9c08325a50a7280e03864f7faac26e96 Mon Sep 17 00:00:00 2001 From: Aditya Balwani Date: Sun, 17 May 2026 16:00:36 -0400 Subject: [PATCH 4/4] ci: simplify publish workflow, inline ghcr.io and wardrowbe --- .github/workflows/docker-publish.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8ed0c87..0e5ad89 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,9 +6,6 @@ on: release: types: [published] -env: - GHCR_REGISTRY: ghcr.io - jobs: publish: name: Publish ${{ matrix.service }} @@ -34,13 +31,10 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - - name: Lowercase image name - run: echo "GHCR_IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV - - name: Login to GHCR uses: docker/login-action@v3 with: - registry: ${{ env.GHCR_REGISTRY }} + registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -50,7 +44,7 @@ jobs: context: ${{ matrix.context }} push: true tags: | - ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${{ matrix.tag_prefix }}-latest - ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${{ matrix.tag_prefix }}-${{ github.sha }} + ghcr.io/${{ github.repository_owner }}/wardrowbe:${{ matrix.tag_prefix }}-latest + ghcr.io/${{ github.repository_owner }}/wardrowbe:${{ matrix.tag_prefix }}-${{ github.sha }} cache-from: type=gha,scope=${{ matrix.service }} cache-to: type=gha,mode=max,scope=${{ matrix.service }}