# 1. Use official Node.js 18 (Alpine) image | |
FROM node:18-alpine | |
# 2. Disable Next.js telemetry | |
ENV NEXT_TELEMETRY_DISABLED=1 | |
# 3. Set working directory | |
WORKDIR /app | |
# 4. Copy package manifest and install all dependencies (including dev) | |
COPY package.json package-lock.json ./ | |
RUN npm ci | |
# 5. Copy source | |
COPY . . | |
# 6. Turn off ESLint during build | |
# (so lint errors won't block the build) | |
RUN printf "module.exports = { eslint: { ignoreDuringBuilds: true } };\n" > next.config.ts | |
# 7. Build your Next.js app | |
RUN npm run build | |
# 8. Expose your custom port | |
ENV PORT=7860 | |
EXPOSE 7860 | |
# 9. Launch in production mode on port 7860 | |
# Assumes you've added in package.json: | |
# "scripts": { "start": "next start -p 7860" } | |
CMD ["npm", "start"] | |