CityTracker/Dockerfile
Claudio Schaad 3debb1ce1e Add CityTracker v1: map-based city tracker with multi-user support
React/Vite frontend and Express/SQLite backend for tracking visited and
planned cities on a map, with per-city notes, photos, links, and
participant-based sharing between family members. Includes session auth
with admin-managed user accounts, an OSM/Nominatim geocoding proxy, and a
single-image Docker deployment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-20 20:29:25 +02:00

43 lines
1.4 KiB
Docker

# ---- Stage 1: build shared + client (static assets) ----
FROM node:20-bookworm-slim AS build-client
WORKDIR /app
COPY package.json ./
COPY shared/package.json shared/package.json
COPY server/package.json server/package.json
COPY client/package.json client/package.json
RUN npm install
COPY shared shared
COPY client client
RUN npm run build -w shared && npm run build -w client
# ---- Stage 2: build shared + server (compiled JS) ----
FROM node:20-bookworm-slim AS build-server
WORKDIR /app
COPY package.json ./
COPY shared/package.json shared/package.json
COPY server/package.json server/package.json
COPY client/package.json client/package.json
RUN npm install
COPY shared shared
COPY server server
RUN npm run build -w shared && npm run build -w server
# ---- Stage 3: runtime ----
# node:20-bookworm-slim (glibc) is used instead of alpine so that better-sqlite3 and argon2's
# native bindings can use prebuilt binaries rather than compiling from source.
FROM node:20-bookworm-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY package.json ./
COPY shared/package.json shared/package.json
COPY server/package.json server/package.json
COPY client/package.json client/package.json
RUN npm install --omit=dev --workspace=shared --workspace=server
COPY --from=build-server /app/shared/dist shared/dist
COPY --from=build-server /app/server/dist server/dist
COPY --from=build-client /app/client/dist client/dist
EXPOSE 3000
CMD ["node", "server/dist/index.js"]