build: docker use pnpm

This commit is contained in:
AkaraChen 2024-10-21 11:27:01 +08:00
parent f6ae13abad
commit 9577cbac27
2 changed files with 9 additions and 7 deletions

View File

@ -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 sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache tzdata 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 # install packages
@ -14,12 +17,12 @@ FROM base AS packages
WORKDIR /app/web WORKDIR /app/web
COPY package.json . COPY package.json .
COPY yarn.lock . COPY pnpm-lock.yaml .
# if you located in China, you can use taobao registry to speed up # 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 # build resources
FROM base AS builder FROM base AS builder
@ -27,7 +30,7 @@ WORKDIR /app/web
COPY --from=packages /app/web/ . COPY --from=packages /app/web/ .
COPY . . COPY . .
RUN yarn build RUN pnpm build
# production stage # production stage
@ -57,8 +60,7 @@ COPY docker/entrypoint.sh ./entrypoint.sh
# global runtime packages # global runtime packages
RUN yarn global add pm2 \ RUN pnpm add -g pm2 \
&& yarn cache clean \
&& mkdir /.pm2 \ && mkdir /.pm2 \
&& chown -R 1001:0 /.pm2 /app/web \ && chown -R 1001:0 /.pm2 /app/web \
&& chmod -R g=u /.pm2 /app/web && chmod -R g=u /.pm2 /app/web

View File

@ -77,7 +77,7 @@ This project uses [Storybook](https://storybook.js.org/) for UI component develo
To start the storybook server, run: To start the storybook server, run:
```bash ```bash
yarn storybook pnpm storybook
``` ```
Open [http://localhost:6006](http://localhost:6006) with your browser to see the result. Open [http://localhost:6006](http://localhost:6006) with your browser to see the result.