Files
cpas/Dockerfile

40 lines
1.5 KiB
Docker
Raw Normal View History

2026-03-06 11:33:32 -06:00
FROM node:20-alpine AS builder
WORKDIR /build
COPY package.json ./
RUN npm install
COPY client/package.json ./client/
RUN cd client && npm install
COPY client/ ./client/
RUN cd client && npm run build
# ── Version metadata ──────────────────────────────────────────────────────────
# Pass these at build time:
# docker build --build-arg GIT_SHA=$(git rev-parse HEAD) \
# --build-arg BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) .
ARG GIT_SHA=dev
ARG BUILD_TIME=unknown
RUN echo "{\"sha\":\"${GIT_SHA}\",\"shortSha\":\"${GIT_SHA:0:7}\",\"buildTime\":\"${BUILD_TIME}\"}" \
> /build/client/dist/version.json
2026-03-06 11:33:32 -06:00
FROM node:20-alpine AS production
2026-03-06 14:11:19 -06:00
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
2026-03-06 11:33:32 -06:00
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV NODE_ENV=production
ENV PORT=3001
ENV DB_PATH=/data/cpas.db
WORKDIR /app
COPY --from=builder /build/node_modules ./node_modules
COPY --from=builder /build/client/dist ./client/dist
2026-03-06 12:24:17 -06:00
COPY server.js ./
2026-03-06 11:33:32 -06:00
COPY package.json ./
2026-03-06 12:24:17 -06:00
COPY db/ ./db/
COPY pdf/ ./pdf/
COPY demo/ ./demo/
2026-03-06 14:11:19 -06:00
COPY client/public/static ./client/dist/static
2026-03-06 11:33:32 -06:00
RUN mkdir -p /data
EXPOSE 3001
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:3001/api/health || exit 1
2026-03-06 11:33:32 -06:00
CMD ["node", "server.js"]