Skip to content

Commit

Permalink
Enable to build and push clover-ui image
Browse files Browse the repository at this point in the history
  • Loading branch information
sankichi92 committed Nov 6, 2024
1 parent 40df1ff commit 72ffadc
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/client-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,52 @@ jobs:
- run: pnpm install

- run: pnpm run typecheck

build:
name: build {{ github.ref_name == 'main' && 'and push' || '' }}
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: arkedge/clover-ui

steps:
- uses: actions/checkout@v4.2.2

- uses: docker/setup-buildx-action@v3.7.1

- uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5.5.1
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
tags: |
type=sha
type=raw,value=latest
- uses: docker/build-push-action@v6.9.0
id: push
with:
context: ./client-ui
push: ${{ github.ref_name == 'main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- uses: actions/attest-build-provenance@v1.4.4
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: ${{ github.ref_name == 'main' }}
33 changes: 33 additions & 0 deletions client-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:22-bullseye-slim AS base

ENV NODE_ENV=production

RUN corepack enable

# build stage

FROM base AS build

WORKDIR /app

COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod=false

COPY . .
RUN pnpm run build
RUN pnpm prune --prod

# runtime stage

FROM base

WORKDIR /app

COPY package.json .
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/build/client /app/build/client
COPY --from=build /app/build/server /app/build/server

RUN corepack install

CMD ["pnpm", "start"]

0 comments on commit 72ffadc

Please sign in to comment.