1414env :
1515 BUILD_REF : ${{ inputs.ref || github.ref_name }}
1616 REGISTRY : ghcr.io
17- IMAGE_NAME : gosuda/portal
1817 PLATFORMS : linux/amd64,linux/arm64
1918
2019concurrency :
@@ -23,7 +22,7 @@ concurrency:
2322
2423jobs :
2524 build :
26- name : Build Binaries
25+ name : Build Artifacts
2726 runs-on : ubuntu-latest
2827
2928 steps :
5251 echo "short_sha=$short_sha" >> "$GITHUB_OUTPUT"
5352 echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
5453 {
55- echo "image_tags<<EOF"
56- echo "${REGISTRY}/${IMAGE_NAME}:branch-${safe_ref}"
57- echo "${REGISTRY}/${IMAGE_NAME}:branch-${safe_ref}-${short_sha}"
54+ echo "portal_image_tags<<EOF"
55+ echo "${REGISTRY}/gosuda/portal:branch-${safe_ref}"
56+ echo "${REGISTRY}/gosuda/portal:branch-${safe_ref}-${short_sha}"
57+ echo "EOF"
58+ echo "frontend_image_tags<<EOF"
59+ echo "${REGISTRY}/gosuda/portal-frontend:branch-${safe_ref}"
60+ echo "${REGISTRY}/gosuda/portal-frontend:branch-${safe_ref}-${short_sha}"
61+ echo "EOF"
62+ echo "portal_api_image_tags<<EOF"
63+ echo "${REGISTRY}/gosuda/portal-api:branch-${safe_ref}"
64+ echo "${REGISTRY}/gosuda/portal-api:branch-${safe_ref}-${short_sha}"
5865 echo "EOF"
5966 } >> "$GITHUB_OUTPUT"
6067
@@ -71,18 +78,51 @@ jobs:
7178 - name : Set up Docker Buildx
7279 uses : docker/setup-buildx-action@v3
7380
74- - name : Build and push Docker image
81+ - name : Build and push portal Docker image
82+ uses : docker/build-push-action@v6
83+ with :
84+ context : .
85+ file : Dockerfile
86+ platforms : ${{ env.PLATFORMS }}
87+ push : true
88+ tags : ${{ steps.meta.outputs.portal_image_tags }}
89+ labels : |
90+ org.opencontainers.image.source=https://github.com/${{ github.repository }}
91+ org.opencontainers.image.revision=${{ steps.meta.outputs.commit_sha }}
92+ org.opencontainers.image.ref.name=${{ env.BUILD_REF }}
93+ cache-from : type=gha,scope=portal
94+ cache-to : type=gha,mode=max,scope=portal
95+
96+ - name : Build and push frontend Docker image
97+ uses : docker/build-push-action@v6
98+ with :
99+ context : ./frontend
100+ file : ./frontend/Dockerfile
101+ platforms : ${{ env.PLATFORMS }}
102+ push : true
103+ tags : ${{ steps.meta.outputs.frontend_image_tags }}
104+ labels : |
105+ org.opencontainers.image.source=https://github.com/${{ github.repository }}
106+ org.opencontainers.image.revision=${{ steps.meta.outputs.commit_sha }}
107+ org.opencontainers.image.ref.name=${{ env.BUILD_REF }}
108+ cache-from : type=gha,scope=frontend
109+ cache-to : type=gha,mode=max,scope=frontend
110+
111+ - name : Build and push portal API Docker image
75112 uses : docker/build-push-action@v6
76113 with :
114+ context : ./frontend
115+ file : ./frontend/Dockerfile
116+ target : api
77117 platforms : ${{ env.PLATFORMS }}
78118 push : true
79- tags : ${{ steps.meta.outputs.image_tags }}
119+ tags : ${{ steps.meta.outputs.portal_api_image_tags }}
80120 labels : |
81121 org.opencontainers.image.source=https://github.com/${{ github.repository }}
82122 org.opencontainers.image.revision=${{ steps.meta.outputs.commit_sha }}
83123 org.opencontainers.image.ref.name=${{ env.BUILD_REF }}
84- cache-from : type=gha,mode=max
85- cache-to : type=gha,mode=max
124+ cache-from : type=gha,scope=portal-api
125+ cache-to : type=gha,mode=max,scope=portal-api
86126
87127 - name : Build binaries
88128 shell : bash
0 commit comments