11# *********************************************************************/
2- # CI Pipeline - Docker Orchestration & Image Distribution */
2+ # CI Pipeline - Docker Orchestration & Image Distribution */
33# */
44# Purpose : Packages the CaseConversionAPI ecosystem into */
55# separate Backend and Frontend images for DockerHub. */
66# Trigger : Push to main / Pull Request to main */
77# Runtime : Ubuntu Latest */
88# */
9- # Notes : - Context set to root (.) to allow cross-repo access. */
10- # - Builds Backend from /backend/Dockerfile. */
11- # - Builds Frontend from /frontend/Dockerfile. */
9+ # Notes : - Builds Backend from /backend/Dockerfile. */
10+ # - Builds Frontend from /frontend/Dockerfile. */
1211# - Requires DOCKER_USERNAME and DOCKER_PASSWORD secrets. */
1312# */
1413# Revision History: */
1514# ------------------------------------------------------------------ */
16- # Version Date Author Description */
15+ # Version Date Author Description */
1716# ------------------------------------------------------------------ */
18- # 1.0 2026-04-14 Nitish Singh Initial Docker Hub Workflow */
19- # 1.1 2026-04-15 Nitish Singh Updated for Monorepo Paths */
20- # 1.2 2026-04-16 Nitish Singh Optimized Context & Metadata */
17+ # 1.0 2026-04-14 Nitish Singh Initial Docker Hub Workflow */
18+ # 1.1 2026-04-15 Nitish Singh Updated for Monorepo Paths */
2119# *********************************************************************/
2220
2321name : Build and Push Docker Images
3129jobs :
3230 docker :
3331 runs-on : ubuntu-latest
32+
3433 steps :
3534 # ======================================================
3635 # 1. WORKSPACE PREPARATION
3736 # ======================================================
37+
3838 - name : Checkout repo
3939 uses : actions/checkout@v4
4040
4141 # ======================================================
4242 # 2. VIRTUALIZED BUILDER SETUP
4343 # ======================================================
44+
4445 - name : Set up Docker Buildx
4546 uses : docker/setup-buildx-action@v3
4647 with :
@@ -49,60 +50,41 @@ jobs:
4950 # ======================================================
5051 # 3. REGISTRY AUTHENTICATION
5152 # ======================================================
53+
5254 - name : Login to DockerHub
53- if : github.event_name != 'pull_request'
5455 uses : docker/login-action@v3
5556 with :
5657 username : ${{ secrets.DOCKER_USERNAME }}
5758 password : ${{ secrets.DOCKER_PASSWORD }}
5859
5960 # ======================================================
60- # 4. METADATA EXTRACTION (Automated Tagging)
61+ # 4. BACKEND: COMPILATION & DISTRIBUTION
6162 # ======================================================
62- - name : Extract Backend Metadata
63- id : meta_backend
64- uses : docker/metadata-action@v5
65- with :
66- images : nitishhsinghhh/case-api
67- tags : |
68- type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
69- type=raw,value=staging,enable=${{ github.ref == 'refs/heads/main' }}
70- type=ref,event=pr
7163
72- - name : Extract Frontend Metadata
73- id : meta_frontend
74- uses : docker/metadata-action@v5
75- with :
76- images : nitishhsinghhh/case-ui
77- tags : |
78- type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
79- type=raw,value=staging,enable=${{ github.ref == 'refs/heads/main' }}
80- type=ref,event=pr
81-
82- # ======================================================
83- # 5. BACKEND: COMPILATION & DISTRIBUTION
84- # ======================================================
8564 - name : Build and Push Backend
8665 uses : docker/build-push-action@v5
8766 with :
88- context : .
67+ context : ./backend
8968 file : ./backend/Dockerfile
90- push : ${{ github.event_name != 'pull_request' }}
91- tags : ${{ steps.meta_backend.outputs.tags }}
92- labels : ${{ steps.meta_backend.outputs.labels }}
69+ push : true
70+ tags : |
71+ nitishhsinghhh/case-api:latest
72+ nitishhsinghhh/case-api:staging
9373 cache-from : type=gha
9474 cache-to : type=gha,mode=max
9575
9676 # ======================================================
97- # 6 . FRONTEND: COMPILATION & DISTRIBUTION
77+ # 5 . FRONTEND: COMPILATION & DISTRIBUTION
9878 # ======================================================
79+
9980 - name : Build and Push Frontend
10081 uses : docker/build-push-action@v5
10182 with :
102- context : .
83+ context : ./frontend
10384 file : ./frontend/Dockerfile
104- push : ${{ github.event_name != 'pull_request' }}
105- tags : ${{ steps.meta_frontend.outputs.tags }}
106- labels : ${{ steps.meta_frontend.outputs.labels }}
85+ push : true
86+ tags : |
87+ nitishhsinghhh/case-ui:latest
88+ nitishhsinghhh/case-ui:staging
10789 cache-from : type=gha
10890 cache-to : type=gha,mode=max
0 commit comments