Skip to content

Commit e3ea782

Browse files
committed
fix: build frontend with pnpm in Docker
1 parent 6759539 commit e3ea782

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ FROM node:20-alpine AS frontend-builder
33

44
RUN apk add --no-cache git python3 make g++
55

6+
RUN corepack enable && \
7+
corepack prepare pnpm@9.15.9 --activate
8+
69
WORKDIR /build
710

811
# 克隆并构建 2024 主题
912
RUN git clone --depth 1 https://github.com/vastsa/FileCodeBoxFronted.git /build/fronted-2024 && \
1013
cd /build/fronted-2024 && \
11-
npm install && \
12-
npm run build
14+
pnpm install --frozen-lockfile --prod=false && \
15+
pnpm run build
1316

1417
# 克隆并构建 2023 主题
1518
RUN git clone --depth 1 https://github.com/vastsa/FileCodeBoxFronted2023.git /build/fronted-2023 && \
@@ -47,10 +50,4 @@ ENV HOST="0.0.0.0" \
4750
EXPOSE 12345
4851

4952
# 生产环境启动命令
50-
CMD uvicorn main:app \
51-
--host $HOST \
52-
--port $PORT \
53-
--workers $WORKERS \
54-
--log-level $LOG_LEVEL \
55-
--proxy-headers \
56-
--forwarded-allow-ips "*"
53+
CMD ["sh", "-c", "exec uvicorn main:app --host \"$HOST\" --port \"$PORT\" --workers \"$WORKERS\" --log-level \"$LOG_LEVEL\" --proxy-headers --forwarded-allow-ips '*'"]

0 commit comments

Comments
 (0)