diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..84e9934 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.git +.gitignore +.gitattributes +node_modules +*.log +.env +.env.* +Dockerfile +.dockerignore +README.md +AGENTS.md +DESIGN.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9f63058 --- /dev/null +++ b/Dockerfile @@ -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"]