54b78c2dcf
Stripped 35-var environment block from docker-compose.yml to 5 bootstrap
vars (INFISICAL_CLIENT_ID/SECRET, NODE_ENV, PORT, HOSTNAME). All app
secrets now fetched from Infisical /architools at container boot via
docker-entrypoint.sh (modeled on gis-api's pattern, INFISICAL_APP_PATH
=/architools).
- docker-entrypoint.sh: universal-auth login, fetch /architools + /
root, expand ${/VAR} refs, export, exec CMD. Fails loud on Infisical
unreachable (exit 2/3).
- Dockerfile runner: added curl+jq, COPY entrypoint + chmod +x,
ENTRYPOINT ["/app/docker-entrypoint.sh"]
- compose: build args (NEXT_PUBLIC_*) preserved — build-time inlining
into JS bundle. martin/tile-cache/tippecanoe service env blocks
untouched (legacy, removed in Faza E).
Rotation workflow now: Infisical UI -> ssh satra "cd /opt/architools && docker compose up -d --force-recreate architools". Never docker compose restart (does not refetch).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
68 lines
2.2 KiB
Docker
68 lines
2.2 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM node:22-alpine AS deps
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
# BuildKit cache mount keeps npm's global cache between builds —
|
|
# subsequent npm ci only downloads changed/new packages instead of
|
|
# re-fetching everything from the registry (~30-60s saving).
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm ci --ignore-scripts
|
|
|
|
FROM node:22-alpine AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
# Copy prisma schema first — cached layer for prisma generate
|
|
COPY prisma ./prisma
|
|
RUN npx prisma generate
|
|
|
|
# Now copy the rest of the source
|
|
COPY . .
|
|
|
|
# Build args for NEXT_PUBLIC_* vars (inlined at build time)
|
|
ARG NEXT_PUBLIC_STORAGE_ADAPTER=database
|
|
ARG NEXT_PUBLIC_APP_NAME=ArchiTools
|
|
ARG NEXT_PUBLIC_APP_URL=https://tools.beletage.ro
|
|
ARG NEXT_PUBLIC_MARTIN_URL=https://tools.beletage.ro/tiles
|
|
ARG NEXT_PUBLIC_PMTILES_URL=
|
|
ENV NEXT_PUBLIC_STORAGE_ADAPTER=${NEXT_PUBLIC_STORAGE_ADAPTER}
|
|
ENV NEXT_PUBLIC_APP_NAME=${NEXT_PUBLIC_APP_NAME}
|
|
ENV NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL}
|
|
ENV NEXT_PUBLIC_MARTIN_URL=${NEXT_PUBLIC_MARTIN_URL}
|
|
ENV NEXT_PUBLIC_PMTILES_URL=${NEXT_PUBLIC_PMTILES_URL}
|
|
|
|
# Increase memory for Next.js build if VM has limited RAM
|
|
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
|
|
|
RUN npm run build
|
|
|
|
FROM node:22-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV TZ=Europe/Bucharest
|
|
|
|
# Install system deps + create user in a single layer
|
|
# curl + jq required by docker-entrypoint.sh for Infisical runtime bootstrap
|
|
RUN apk add --no-cache gdal gdal-tools ghostscript qpdf tzdata curl jq \
|
|
&& addgroup --system --gid 1001 nodejs \
|
|
&& adduser --system --uid 1001 nextjs
|
|
|
|
# Note: DWG→DXF conversion handled by dwg2dxf sidecar container (see docker-compose.yml)
|
|
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
|
|
RUN chmod +x /app/docker-entrypoint.sh
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
|
CMD ["node", "server.js"]
|