mirror of
https://github.com/vastxie/99AI.git
synced 2024-11-16 03:32:42 +08:00
优化镜像体积
缩小体积
This commit is contained in:
parent
11283a3906
commit
49a72b7198
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ node_modules
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
sql
|
sql
|
||||||
data
|
data
|
||||||
|
.idea
|
||||||
|
|
21
Dockerfile
21
Dockerfile
|
@ -1,8 +1,8 @@
|
||||||
# 编译阶段
|
# 编译阶段
|
||||||
FROM node:18-alpine AS build
|
FROM node:18-alpine AS base
|
||||||
|
FROM base AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY package.json ./
|
||||||
|
|
||||||
# 使用腾讯源(国内服务器可取消下方注释以提升安装速度)
|
# 使用腾讯源(国内服务器可取消下方注释以提升安装速度)
|
||||||
# RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
|
# RUN npm config set registry https://mirrors.cloud.tencent.com/npm/
|
||||||
|
@ -13,16 +13,21 @@ COPY . .
|
||||||
# 如遇到提示网站证书无效,取消下方注释,禁止严格SS策略
|
# 如遇到提示网站证书无效,取消下方注释,禁止严格SS策略
|
||||||
# RUN npm config set strict-ssl false
|
# RUN npm config set strict-ssl false
|
||||||
|
|
||||||
# 使用 pnpm 安装项目依赖
|
# 安装项目依赖
|
||||||
RUN npm install -g pnpm
|
RUN apk add --no-cache --virtual .build-deps git && \
|
||||||
RUN pnpm install
|
npm install --omit=dev && \
|
||||||
|
apk del .build-deps
|
||||||
|
|
||||||
|
|
||||||
# 运行阶段
|
# 运行阶段
|
||||||
FROM node:18-alpine
|
FROM base AS runner
|
||||||
ENV TZ="Asia/Shanghai"
|
ENV TZ="Asia/Shanghai"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /app .
|
|
||||||
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 9520
|
EXPOSE 9520
|
||||||
|
|
||||||
CMD ["node", "./dist/main.js"]
|
CMD ["node", "./dist/main.js"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user