feat: 优化部署配置
自动部署 / build (push) Successful in 7m50s
Details
自动部署 / build (push) Successful in 7m50s
Details
parent
f52342988d
commit
e6d2adef44
20
Dockerfile
20
Dockerfile
|
|
@ -1,21 +1,23 @@
|
|||
FROM node:18-alpine As dev
|
||||
FROM node:20-alpine As builder
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
||||
RUN apk update && apk add sqlite
|
||||
RUN apk add --no-cache --virtual .build-deps g++ gcc libgcc libstdc++ linux-headers make python3
|
||||
WORKDIR /app
|
||||
COPY package*.json .
|
||||
RUN npm install
|
||||
COPY .npmrc .
|
||||
RUN corepack enable
|
||||
RUN pnpm install
|
||||
COPY . .
|
||||
RUN npm run build && npm prune --production
|
||||
RUN pnpm build && pnpm prune --prod
|
||||
|
||||
FROM node:18-alpine As build
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV production
|
||||
COPY --from=dev /app/content/ ./content/
|
||||
COPY --from=dev /app/dist/ ./dist/
|
||||
COPY --from=dev /app/node_modules/ ./node_modules/
|
||||
COPY --from=dev /app/.env ./
|
||||
COPY --from=dev /app/package.json ./
|
||||
COPY --from=builder /app/content/ ./content/
|
||||
COPY --from=builder /app/dist/ ./dist/
|
||||
COPY --from=builder /app/node_modules/ ./node_modules/
|
||||
COPY --from=builder /app/.env ./
|
||||
COPY --from=builder /app/package.json ./
|
||||
|
||||
EXPOSE 3030
|
||||
CMD [ "node", "./dist/main.js" ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue