-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (36 loc) · 1.34 KB
/
Dockerfile
File metadata and controls
52 lines (36 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## Stage 1: Build Next.js app
# Expects these files to exist in the build context (prepared by CI):
# website/public/pmtiles/communes.pmtiles ← generated by build_pmtiles.py
# data/exploration/<DUCKDB_FILE> ← downloaded/trimmed from S3 (default: website.duckdb)
#
# Override the database file with: --build-arg DUCKDB_FILE=dev.duckdb
FROM node:22-slim AS builder
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
COPY website/package*.json ./
RUN npm ci
COPY website/ ./
ARG DUCKDB_FILE=website.duckdb
COPY data/exploration/${DUCKDB_FILE} /data/database.duckdb
ENV DUCKDB_PATH=/data/database.duckdb
RUN npm run build
## Stage 2: Production runtime
FROM node:22-slim AS runner
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
WORKDIR /app
RUN chown nextjs:nodejs /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV DUCKDB_PATH=/data/database.duckdb
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV HOME=/app
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
RUN mkdir -p /data && chown nextjs:nodejs /data
COPY --from=builder --chown=nextjs:nodejs /data/database.duckdb /data/database.duckdb
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]