Files
sharepoint-acc-sync/Dockerfile
2026-10-23 06:52:20 -05:00

35 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1
FROM node:24-bookworm-slim AS base
WORKDIR /app
# Build stage. better-sqlite3 normally downloads a prebuilt binary; the compilers
# are only a fallback for when no prebuilt one matches.
FROM base AS build
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json .npmrc ./
RUN npm ci
COPY . .
# The address users open the app at, when served over plain HTTP (see docs/runbook.md).
ARG ORIGIN
RUN npm run build && npm prune --omit=dev
# Runtime stage: the built server, production dependencies and the migrations.
FROM base
ENV NODE_ENV=production \
PORT=3000 \
DATABASE_PATH=/data/sync.db
COPY --from=build /app/package.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/build ./build
COPY --from=build /app/drizzle ./drizzle
RUN mkdir /data && chown node:node /data
USER node
VOLUME /data
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD ["node", "-e", "fetch(`http://127.0.0.1:${process.env.PORT}/healthz`).then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"]
CMD ["node", "build"]