feat(docker): add production-ready container deployment

This commit is contained in:
rbetree
2026-02-19 17:53:48 +08:00
parent cc48a02676
commit eea801bef3
5 changed files with 148 additions and 1 deletions

37
Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
# syntax=docker/dockerfile:1.7
FROM node:22-alpine AS builder
WORKDIR /app
ENV HUSKY=0
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ARG MENAV_ENABLE_SYNC=false
ARG MENAV_IMPORT_BOOKMARKS=false
RUN if [ "${MENAV_IMPORT_BOOKMARKS}" = "true" ]; then \
MENAV_BOOKMARKS_DETERMINISTIC=1 npm run import-bookmarks; \
fi \
&& if [ "${MENAV_ENABLE_SYNC}" = "true" ]; then \
npm run build; \
else \
PROJECTS_ENABLED=false HEATMAP_ENABLED=false RSS_ENABLED=false npm run build; \
fi
FROM nginx:1.27-alpine AS runtime
WORKDIR /usr/share/nginx/html
COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist ./
EXPOSE 80
STOPSIGNAL SIGQUIT
CMD ["nginx", "-g", "daemon off;"]