All checks were successful
Build and Deploy / Build & Push (push) Successful in 2m54s
- Add lib/park-meta.ts to manage data/park-meta.json (rcdb_id + coaster lists) - Add lib/scrapers/rcdb.ts to scrape operating coaster names from RCDB park pages - discover.ts now seeds park-meta.json with skeleton entries for all parks - scrape.ts now refreshes RCDB coaster lists (30-day staleness) for parks with rcdb_id set - fetchLiveRides() accepts a coasterNames Set; isCoaster uses normalize() on both sides to handle trademark symbols, 'THE ' prefixes, and punctuation differences between Queue-Times and RCDB names — applies correctly to both land rides and top-level rides - Commit park-meta.json so it ships in the Docker image (fresh volumes get it automatically) - Update .gitignore / .dockerignore to exclude only *.db files, not all of data/ - Dockerfile copies park-meta.json into image before VOLUME declaration - README: document coaster filter setup and correct staleness window (72h not 7d) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
63 lines
2.3 KiB
Docker
63 lines
2.3 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
|
|
|
|
# Seed data directory with park-meta.json (RCDB coaster lists + rcdb_id mappings).
|
|
# Must be copied before VOLUME so Docker initialises a fresh named volume with
|
|
# this file already present. Existing volumes retain their own copy.
|
|
RUN mkdir -p /app/data && chown nextjs:nodejs /app/data
|
|
COPY --from=builder --chown=nextjs:nodejs /app/data/park-meta.json ./data/park-meta.json
|
|
|
|
# SQLite database lives here — mount a named volume for persistence
|
|
VOLUME ["/app/data"]
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|