|
9 | 9 |
|
10 | 10 | env: |
11 | 11 | REGISTRY: tpsappscriptingacr.azurecr.io |
| 12 | + IMAGE_EDITOR: app-scripting-editor |
12 | 13 | IMAGE_API: app-scripting-editor-api |
13 | 14 |
|
14 | 15 | jobs: |
@@ -36,20 +37,33 @@ jobs: |
36 | 37 | - name: Set up Docker Buildx |
37 | 38 | uses: docker/setup-buildx-action@v3 |
38 | 39 |
|
39 | | - # ---- Build API (Node/Express) image ---- |
40 | | - # NOTE: Your API Dockerfile copies the SPA from ${REGISTRY}/app-scripting-editor:latest. |
41 | | - # Make sure that image exists in ACR, or switch to the "self-contained" Dockerfile approach below. |
42 | | - - name: Build & push API image (Node/Express + SPA) |
| 40 | + # ---- Step 1: Build Frontend (Editor) image first ---- |
| 41 | + - name: Build & push Editor image (Frontend/nginx) |
43 | 42 | uses: docker/build-push-action@v6 |
44 | 43 | with: |
45 | 44 | context: . |
46 | | - file: ./Dockerfile # change if your API Dockerfile lives elsewhere |
| 45 | + file: ./Dockerfile |
47 | 46 | push: true |
48 | 47 | build-args: | |
49 | | - REGISTRY=${{ env.REGISTRY }} |
50 | 48 | VITE_APP_VERSION=1.0.0 |
51 | 49 | VITE_APP_BUILD_TIME=${{ github.event.head_commit.timestamp }} |
52 | 50 | VITE_APP_COMMIT_SHA=${{ github.sha }} |
| 51 | + tags: | |
| 52 | + ${{ env.REGISTRY }}/${{ env.IMAGE_EDITOR }}:latest |
| 53 | + ${{ env.REGISTRY }}/${{ env.IMAGE_EDITOR }}:${{ github.sha }} |
| 54 | + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_EDITOR }}:buildcache |
| 55 | + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_EDITOR }}:buildcache,mode=max |
| 56 | + |
| 57 | + # ---- Step 2: Build API (Node/Express + Frontend) image ---- |
| 58 | + # This uses the editor image we just built above |
| 59 | + - name: Build & push API image (Node/Express + SPA) |
| 60 | + uses: docker/build-push-action@v6 |
| 61 | + with: |
| 62 | + context: . |
| 63 | + file: ./server/Dockerfile |
| 64 | + push: true |
| 65 | + build-args: | |
| 66 | + REGISTRY=${{ env.REGISTRY }} |
53 | 67 | tags: | |
54 | 68 | ${{ env.REGISTRY }}/${{ env.IMAGE_API }}:latest |
55 | 69 | ${{ env.REGISTRY }}/${{ env.IMAGE_API }}:${{ github.sha }} |
|
0 commit comments