26 lines
812 B
Docker
26 lines
812 B
Docker
|
|
FROM node:22-alpine AS build
|
||
|
|
WORKDIR /app
|
||
|
|
# better-sqlite3 has a native addon with no prebuilt binary for this
|
||
|
|
# platform/Node combo yet — build it from source.
|
||
|
|
RUN apk add --no-cache python3 make g++
|
||
|
|
COPY package*.json ./
|
||
|
|
RUN npm install
|
||
|
|
COPY . .
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
FROM node:22-alpine
|
||
|
|
WORKDIR /app
|
||
|
|
# Same native-addon rebuild needed for the production-only install below;
|
||
|
|
# the toolchain is purged again afterward to keep the runtime image lean.
|
||
|
|
RUN apk add --no-cache python3 make g++
|
||
|
|
COPY package*.json ./
|
||
|
|
RUN npm install --omit=dev && apk del python3 make g++
|
||
|
|
COPY --from=build /app/dist ./dist
|
||
|
|
|
||
|
|
# DATA_DIR (SQLite DB) is a mutable runtime volume — not baked into the
|
||
|
|
# image, so redeploys don't clobber recipients/grants/vaults.
|
||
|
|
ENV DATA_DIR=/app/data
|
||
|
|
|
||
|
|
EXPOSE 3050
|
||
|
|
CMD ["node", "dist/server/index.js"]
|