4a673ebb28
Adds basePath config, withBase/appUrl helpers, base-path-aware cookies, OAuth redirects, manifest, service worker and cron runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.6 KiB
Docker
35 lines
1.6 KiB
Docker
FROM node:22-bookworm-slim AS build
|
|
WORKDIR /app
|
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
COPY package.json package-lock.json ./
|
|
COPY prisma ./prisma
|
|
RUN npm ci
|
|
COPY . .
|
|
# Sub-path deploy (e.g. /pagiva) — inlined at build time, so changing it needs a rebuild.
|
|
ARG NEXT_PUBLIC_BASE_PATH=
|
|
ARG NEXT_PUBLIC_APP_URL=
|
|
ENV NEXT_PUBLIC_BASE_PATH=$NEXT_PUBLIC_BASE_PATH NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL
|
|
RUN npm run build
|
|
|
|
FROM node:22-bookworm-slim
|
|
WORKDIR /app
|
|
ARG NEXT_PUBLIC_BASE_PATH=
|
|
ENV NEXT_PUBLIC_BASE_PATH=$NEXT_PUBLIC_BASE_PATH
|
|
ENV NODE_ENV=production HOSTNAME=0.0.0.0 PORT=3000 NEXT_TELEMETRY_DISABLED=1
|
|
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates curl && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=build /app/.next/standalone ./
|
|
# Standalone only traces what server.js imports — overlay the full node_modules
|
|
# so the `prisma` CLI (invoked by name below, not imported) is present too.
|
|
COPY --from=build /app/node_modules ./node_modules
|
|
COPY --from=build /app/.next/static ./.next/static
|
|
COPY --from=build /app/public ./public
|
|
COPY --from=build /app/prisma ./prisma
|
|
# Prisma 7 reads datasource.url from this file, not schema.prisma — required
|
|
# for `prisma migrate deploy` at container start.
|
|
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
|
|
COPY --from=build /app/scripts ./scripts
|
|
RUN mkdir -p /app/.data/uploads && chown -R node:node /app
|
|
USER node
|
|
EXPOSE 3000
|
|
CMD ["sh", "-c", "npx prisma migrate deploy && (node scripts/cron-runner.mjs &) && exec node server.js"]
|