All checks were successful
Build and Deploy / Build & Push (push) Successful in 3m34s
Volume mount hides image-layer files on existing deployments anyway. Deploy manually: curl -o park-meta.json <gitea-raw-url> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
2.0 KiB
Docker
58 lines
2.0 KiB
Docker
# Stage 1: Install all dependencies (dev included — scripts need tsx + playwright)
|
|
FROM node:22-bookworm-slim AS deps
|
|
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm ci
|
|
|
|
# Stage 2: Build the Next.js app
|
|
FROM deps AS builder
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Stage 3: Production runner
|
|
FROM node:22-bookworm-slim AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
# Store Playwright browser in a predictable path inside the image
|
|
ENV PLAYWRIGHT_BROWSERS_PATH=/app/.playwright
|
|
|
|
# Create non-root user before copying files so --chown works
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
|
|
# Copy Next.js standalone output
|
|
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
|
|
|
|
# Copy scripts + library source (needed for npm run discover/scrape via tsx)
|
|
COPY --from=builder --chown=nextjs:nodejs /app/scripts ./scripts
|
|
COPY --from=builder --chown=nextjs:nodejs /app/lib ./lib
|
|
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
|
|
COPY --from=builder --chown=nextjs:nodejs /app/tsconfig.json ./tsconfig.json
|
|
|
|
# Replace standalone's minimal node_modules with full deps
|
|
# (includes tsx, playwright, and all devDependencies)
|
|
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
|
|
|
|
# Install Playwright Chromium browser + all required system libraries.
|
|
# Runs as root so apt-get works; browser lands in PLAYWRIGHT_BROWSERS_PATH.
|
|
RUN npx playwright install --with-deps chromium && \
|
|
chown -R nextjs:nodejs /app/.playwright
|
|
|
|
# SQLite data directory — mount a named volume here for persistence
|
|
RUN mkdir -p /app/data && chown nextjs:nodejs /app/data
|
|
VOLUME ["/app/data"]
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|