build: add Dockerfile + .dockerignore (node:22-alpine, git, non-root)

This commit is contained in:
Bkk1234 committed 2026-11-21 16:13:13 +07:00
1 parent 0bfbefd930
commit 7d57a972e7
2 files changed
+43

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
.git
.gitignore
.gitattributes
node_modules
*.log
.env
.env.*
Dockerfile
.dockerignore
README.md
AGENTS.md
DESIGN.md
+31
View File
@@ -0,0 +1,31 @@
# hobbypj-contents — เพจรายชื่อโปรเจค + หลังบ้าน (Node stdlib ล้วน ไม่มี dependency)
FROM node:22-alpine
# ต้องมี git เพราะ server/publish.mjs ใช้ commit + push ข้อมูลขึ้น Gitea
RUN apk add --no-cache git tini
WORKDIR /app
# ไม่มี dependencies ภายนอก — copy โค้ดทั้งชุดได้เลย
COPY --chown=node:node package.json ./
COPY --chown=node:node index.html manifest.json sw.js ./
COPY --chown=node:node ui/ ./ui/
COPY --chown=node:node server/ ./server/
COPY --chown=node:node data/ ./data/
COPY --chown=node:node assets/ ./assets/
COPY --chown=node:node fonts/ ./fonts/
COPY --chown=node:node icons/ ./icons/
COPY --chown=node:node config/ ./config/
ENV NODE_ENV=production \
PORT=8090 \
HOST=0.0.0.0 \
PUBLISH_PUSH=0
USER node
EXPOSE 8090
# ไม่ใส่ HEALTHCHECK: OCI format ของ podman ไม่รับ และ WSL ไม่มี systemd ให้ timer
# ตรวจสุขภาพเองด้วย: curl -fsS http://127.0.0.1:8090/api/projects
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "server/publish.mjs"]