Skip to content

Commit feb2384

Browse files
committed
Enable to build and push clover-ui image
1 parent 40df1ff commit feb2384

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/client-ui.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,54 @@ jobs:
5858
- run: pnpm install
5959

6060
- run: pnpm run typecheck
61+
62+
build:
63+
name: build ${{ github.ref_name == 'main' && 'and push' || '' }}
64+
runs-on: ubuntu-latest
65+
66+
permissions:
67+
contents: read
68+
packages: write
69+
attestations: write
70+
id-token: write
71+
72+
env:
73+
REGISTRY: ghcr.io
74+
IMAGE_NAME: arkedge/clover-ui
75+
76+
steps:
77+
- uses: actions/checkout@v4.2.2
78+
79+
- uses: docker/setup-buildx-action@v3.7.1
80+
81+
- uses: docker/login-action@v3.3.0
82+
if: github.ref_name == 'main'
83+
with:
84+
registry: ${{ env.REGISTRY }}
85+
username: ${{ github.actor }}
86+
password: ${{ secrets.GITHUB_TOKEN }}
87+
88+
- uses: docker/metadata-action@v5.5.1
89+
id: meta
90+
with:
91+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
92+
tags: |
93+
type=sha,format=long,prefix=
94+
type=raw,value=latest
95+
96+
- uses: docker/build-push-action@v6.9.0
97+
id: build-push
98+
with:
99+
context: ./client-ui
100+
push: ${{ github.ref_name == 'main' }}
101+
tags: ${{ steps.meta.outputs.tags }}
102+
labels: ${{ steps.meta.outputs.labels }}
103+
cache-from: type=gha
104+
cache-to: type=gha,mode=max
105+
106+
- uses: actions/attest-build-provenance@v1.4.4
107+
if: github.ref_name == 'main'
108+
with:
109+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
110+
subject-digest: ${{ steps.build-push.outputs.digest }}
111+
push-to-registry: true

client-ui/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM node:22-bullseye-slim AS base
2+
3+
ENV NODE_ENV=production
4+
5+
RUN corepack enable
6+
7+
# build stage
8+
9+
FROM base AS build
10+
11+
WORKDIR /app
12+
13+
COPY package.json pnpm-lock.yaml ./
14+
RUN pnpm install --frozen-lockfile --prod=false
15+
16+
COPY . .
17+
RUN pnpm run build
18+
RUN pnpm prune --prod
19+
20+
# runtime stage
21+
22+
FROM base
23+
24+
WORKDIR /app
25+
26+
COPY package.json .
27+
COPY --from=build /app/node_modules /app/node_modules
28+
COPY --from=build /app/build/client /app/build/client
29+
COPY --from=build /app/build/server /app/build/server
30+
31+
RUN corepack install
32+
33+
CMD ["pnpm", "start"]

0 commit comments

Comments
 (0)