parent
93e59a14b9
commit
ce3c34556e
@ -1,15 +1,26 @@
|
||||
# 使用阿里云镜像
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine
|
||||
# 使用官方Node.js镜像作为基础镜像
|
||||
FROM node:18-alpine
|
||||
LABEL maintainer="hejiayu <hejy47@nudt.edu.cn>"
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /gitlink_help_center
|
||||
|
||||
# 设置 npm 和 yarn 使用淘宝镜像
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
RUN yarn config set registry https://registry.npmmirror.com
|
||||
# 设置npm和yarn使用淘宝镜像源,加快依赖安装速度
|
||||
RUN npm config set registry https://registry.npmmirror.com && \
|
||||
yarn config set registry https://registry.npmmirror.com
|
||||
|
||||
COPY ./ /gitlink_help_center/
|
||||
# 复制项目文件
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
RUN yarn install
|
||||
RUN npm run build -- --locale zh-cn
|
||||
# 复制其余项目文件
|
||||
COPY . .
|
||||
|
||||
# 构建项目
|
||||
RUN yarn build --locale zh-cn
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 3000
|
||||
|
||||
# 启动命令
|
||||
CMD ["npm", "run", "serve"]
|
Loading…
Reference in new issue