RealKai42 / qwerty-learner

为键盘工作者设计的单词记忆与英语肌肉记忆锻炼软件 / Words learning and English muscle memory training software designed for keyboard workers
https://qwerty.kaiyi.cool/
GNU General Public License v3.0
15.33k stars 1.43k forks source link

chore: docker compose deployment #771

Closed luojiyin1987 closed 2 months ago

luojiyin1987 commented 5 months ago

抽象 简化 docker compose 部署

770

760

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

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

vercel[bot] commented 5 months ago

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
HerbertHe commented 5 months ago

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

luojiyin1987 commented 5 months ago

可以打包好的文件放到 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
RealKai42 commented 2 months ago

👍!