+15
-12
@@ -10,9 +10,6 @@ RUN npm install
|
||||
COPY . .
|
||||
|
||||
# Build Next.js app
|
||||
# NEXT_PUBLIC_API_URL should be set during build if used in static generation
|
||||
# For production, we usually point to the domain name
|
||||
ENV NEXT_PUBLIC_API_URL=https://api.iddaai.com/api
|
||||
RUN npm run build
|
||||
|
||||
# --- STAGE 2: RUNNER ---
|
||||
@@ -21,16 +18,22 @@ WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Copy only necessary files
|
||||
COPY --from=builder /app/package*.json ./
|
||||
COPY --from=builder /app/.next ./.next
|
||||
# Don't run as root
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# Copy standalone build
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/next.config.ts ./
|
||||
# Copy messages for internationalization
|
||||
COPY --from=builder /app/messages ./messages
|
||||
|
||||
# Set permissions for standalone build
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Start Next.js
|
||||
CMD ["npm", "start"]
|
||||
# Start standalone server
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
Reference in New Issue
Block a user