build: dockerfile based on playwright image, standalone next.js
This commit is contained in:
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
||||
node_modules
|
||||
.next
|
||||
.git
|
||||
.env
|
||||
.env.local
|
||||
*.log
|
||||
tests
|
||||
docs
|
||||
README.md
|
||||
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# syntax=docker/dockerfile:1.7
|
||||
|
||||
# --- deps + build use the Bun image so we honor bun.lock ---
|
||||
FROM oven/bun:1.3 AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json bun.lock* ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
FROM oven/bun:1.3 AS build
|
||||
WORKDIR /app
|
||||
# Dummy DATABASE_URL so Next.js can collect page data at build time.
|
||||
# The real value is injected at runtime via env vars.
|
||||
ENV DATABASE_URL=postgres://build:build@localhost:5432/build
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
# --- runner: Playwright base image so the scraper has browsers available ---
|
||||
FROM mcr.microsoft.com/playwright:v1.50.0-jammy AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
COPY --from=build /app/.next/standalone ./
|
||||
COPY --from=build /app/.next/static ./.next/static
|
||||
COPY --from=build /app/public ./public
|
||||
COPY --from=build /app/drizzle ./drizzle
|
||||
COPY --from=build /app/drizzle.config.ts ./
|
||||
COPY --from=build /app/src/lib/db/schema.ts ./schema.ts
|
||||
EXPOSE 3000
|
||||
CMD ["node", "server.js"]
|
||||
0
public/.gitkeep
Normal file
0
public/.gitkeep
Normal file
Reference in New Issue
Block a user