Compare commits
No commits in common. "13a389efc8782862b1ce42f708b5530184040e96" and "9b65e38542cf90454b10e06a0da8d6f413fdbfc0" have entirely different histories.
13a389efc8
...
9b65e38542
@ -1,5 +1,6 @@
|
|||||||
FASTAPI_URL="http://localhost:8000"
|
FASTAPI_URL="http://localhost:8000"
|
||||||
INTERNAL_API_BASE_URL="http://localhost:3005"
|
INTERNAL_API_BASE_URL="http://localhost:3005"
|
||||||
|
|
||||||
DATABASE_URL="postgresql://user:pass@localhost:5432/rooftop?schema=public"
|
|
||||||
|
DATABASE_URL="postgresql://postgres:root@localhost:5432/rooftop?schema=public"
|
||||||
JWT_SECRET="secret_key"
|
JWT_SECRET="secret_key"
|
||||||
|
|||||||
62
Dockerfile
62
Dockerfile
@ -1,54 +1,26 @@
|
|||||||
# syntax=docker/dockerfile:1
|
FROM node:18
|
||||||
|
|
||||||
# ---- Build stage ----
|
|
||||||
ARG NODE_VERSION=20
|
|
||||||
FROM node:${NODE_VERSION}-slim AS builder
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
|
||||||
|
|
||||||
# Build-time public env hook
|
|
||||||
ARG NEXT_PUBLIC_FASTAPI_URL
|
|
||||||
ENV NEXT_PUBLIC_FASTAPI_URL=${NEXT_PUBLIC_FASTAPI_URL}
|
|
||||||
|
|
||||||
# 1) Install deps with caching
|
|
||||||
COPY package.json package-lock.json* ./
|
|
||||||
RUN npm ci
|
|
||||||
|
|
||||||
# 2) Copy source
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 3) Generate Prisma client (safe no-op if unused)
|
# Accept build-time arguments
|
||||||
RUN npx prisma generate || true
|
ARG FASTAPI_URL
|
||||||
|
ARG INTERNAL_API_BASE_URL
|
||||||
|
ARG DATABASE_URL
|
||||||
|
ARG JWT_SECRET
|
||||||
|
|
||||||
# 4) Build Next.js (requires next.config.js => output: 'standalone')
|
# Assign them to environment variables inside the image
|
||||||
|
ENV FASTAPI_URL=$FASTAPI_URL
|
||||||
|
ENV INTERNAL_API_BASE_URL=$INTERNAL_API_BASE_URL
|
||||||
|
ENV DATABASE_URL=$DATABASE_URL
|
||||||
|
ENV JWT_SECRET=$JWT_SECRET
|
||||||
|
|
||||||
|
RUN npm install --force
|
||||||
|
|
||||||
|
# Build Next.js app
|
||||||
|
RUN npx prisma generate
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ---- Runtime stage ----
|
|
||||||
FROM node:${NODE_VERSION}-slim AS runner
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
ENV NODE_ENV=production \
|
|
||||||
NEXT_TELEMETRY_DISABLED=1 \
|
|
||||||
HOSTNAME=0.0.0.0 \
|
|
||||||
PORT=3005
|
|
||||||
|
|
||||||
# Minimal server & assets
|
|
||||||
COPY --from=builder /app/.next/standalone ./
|
|
||||||
COPY --from=builder /app/.next/static ./.next/static
|
|
||||||
COPY --from=builder /app/public ./public
|
|
||||||
COPY --from=builder /app/prisma ./prisma
|
|
||||||
|
|
||||||
# Optional (only if Prisma engine errors show up):
|
|
||||||
# COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
|
||||||
# COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
|
||||||
|
|
||||||
USER node
|
|
||||||
EXPOSE 3005
|
EXPOSE 3005
|
||||||
|
|
||||||
# (Optional) healthcheck
|
CMD ["npm", "start"]
|
||||||
# HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
||||||
# CMD node -e "require('http').get('http://127.0.0.1:'+(process.env.PORT||3005)+'/_next/static/webpack/')"
|
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
|
||||||
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
output: 'standalone',
|
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
swcMinify: true,
|
swcMinify: true,
|
||||||
eslint: {
|
eslint: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user