qwerty-learner icon indicating copy to clipboard operation
qwerty-learner copied to clipboard

chore: docker compose deployment

Open luojiyin1987 opened this issue 1 year ago • 3 comments

抽象 简化 docker compose 部署

#770 #760

本来想用原来的 Dockerfile 构建镜像的, 考虑到前端可能不太熟悉 Nginx, 新建 build.yml 文件进行镜像构建。

副作用是构建镜像偏大,达1.6G。 如果有需求,可以在后期优化镜像大小。

luojiyin1987 avatar Apr 05 '24 07:04 luojiyin1987

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
qwerty-learner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 0:05am

vercel[bot] avatar Apr 05 '24 07:04 vercel[bot]

@luojiyin1987 docker 构建的话可以用 node:alpine 的镜像,实际构建的结果小多了,还有就是 node16 已经放弃维护了,最新的lts 已经是 node20 了

HerbertHe avatar Apr 07 '24 14:04 HerbertHe

可以打包好的文件放到 nginx 的里, 镜像大小可以100 M 左右。我考虑的点是用 node 镜像运行的可以输出有关日志,方便调试。 用 Nginx 的镜像运行,镜像体积小。 @HerbertHe

# 第二阶段:运行应用
FROM nginx:alpine
WORKDIR /app
COPY ./public/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder  /app/build /app

luojiyin1987 avatar Apr 07 '24 14:04 luojiyin1987

👍!

RealKai42 avatar Jun 11 '24 09:06 RealKai42