提交 bafee077 作者: 方治民

feat: 添加 dockerfile 镜像构建

上级 1f827a47
Dockerfile
.dockerignore
node_modules
npm-debug.log
dist
.git
.github
.env
volume
shamefully-hoist=true
auto-install-peers=false
registry=https://registry.npmmirror.com
# https://juejin.cn/post/7244567350720184357
PUPPETEER_DOWNLOAD_BASE_URL=https://registry.npmmirror.com/-/binary/chrome-for-testing
# 使用 Puppeteer 官方镜像作为基础镜像(基于 Node 镜像构建)
FROM keymetrics/pm2:16-alpine
# 设置工作目录
WORKDIR /usr/src/app
# 挂载 bin(启动脚本), app(源码), data(资源)
VOLUME ["/usr/src/app/data", "/usr/src/app/bin", "/usr/src/app/app"]
# 将 .npmrc, package.json 和 package-lock.json 复制到工作目录
COPY .npmrc ./
COPY yarn.lock ./
COPY package*.json ./
# 安装依赖
RUN yarn
# 将项目文件复制到工作目录
COPY . .
# 暴露应用端口
EXPOSE 1234
# 设置时区
ENV TZ=Asia/Shanghai
# 运行 NestJS 应用
CMD [ "pm2-runtime", "start", "./bin/www" ]
......@@ -11,6 +11,7 @@
"lint": "eslint app/**/*.js",
"format": "prettier-eslint --write app/**/*.js",
"dist": "pkg . --out-path=dist/ --targets=win,linux,macos --compress=GZip",
"dist:linux": "pkg . --out-path=dist/ --targets=linux --compress=GZip",
"dist:win": "pkg . --out-path=dist/ --targets=win --compress=GZip"
},
"engines": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论