From 9577cbac27b19de833e09f01b32c969815b93d6a Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Mon, 21 Oct 2024 11:27:01 +0800 Subject: [PATCH] build: docker use pnpm --- web/Dockerfile | 14 ++++++++------ web/README.md | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 29f7675f4a..0610300361 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -6,6 +6,9 @@ LABEL maintainer="takatost@gmail.com" # RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN apk add --no-cache tzdata +RUN npm install -g pnpm@9.12.2 +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" # install packages @@ -14,12 +17,12 @@ FROM base AS packages WORKDIR /app/web COPY package.json . -COPY yarn.lock . +COPY pnpm-lock.yaml . # if you located in China, you can use taobao registry to speed up -# RUN yarn install --frozen-lockfile --registry https://registry.npmmirror.com/ +# RUN pnpm install --frozen-lockfile --registry https://registry.npmmirror.com/ -RUN yarn install --frozen-lockfile +RUN pnpm install --frozen-lockfile # build resources FROM base AS builder @@ -27,7 +30,7 @@ WORKDIR /app/web COPY --from=packages /app/web/ . COPY . . -RUN yarn build +RUN pnpm build # production stage @@ -57,8 +60,7 @@ COPY docker/entrypoint.sh ./entrypoint.sh # global runtime packages -RUN yarn global add pm2 \ - && yarn cache clean \ +RUN pnpm add -g pm2 \ && mkdir /.pm2 \ && chown -R 1001:0 /.pm2 /app/web \ && chmod -R g=u /.pm2 /app/web diff --git a/web/README.md b/web/README.md index 64a460e355..ddba8ed28a 100644 --- a/web/README.md +++ b/web/README.md @@ -77,7 +77,7 @@ This project uses [Storybook](https://storybook.js.org/) for UI component develo To start the storybook server, run: ```bash -yarn storybook +pnpm storybook ``` Open [http://localhost:6006](http://localhost:6006) with your browser to see the result.