- Backend Dockerfile: Python 3.12, non-root user, healthcheck - Frontend Dockerfile: Multi-stage build, production stage - docker-compose.yml: env_file, healthchecks, restart policies - docker-compose.prod.yml: Production config with nginx - .env.example: Updated with all variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.0 KiB
Docker
47 lines
1.0 KiB
Docker
# Frontend Dockerfile for Galaxy-PO
|
|
FROM node:22-alpine AS base
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies only when needed
|
|
FROM base AS deps
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Development stage
|
|
FROM base AS development
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
EXPOSE 3000
|
|
CMD ["npm", "run", "dev"]
|
|
|
|
# Build stage
|
|
FROM base AS builder
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM base AS production
|
|
ENV NODE_ENV=production
|
|
|
|
# Create non-root user
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
|
|
COPY --from=builder /app/public ./public
|
|
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"
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/ || exit 1
|
|
|
|
CMD ["node", "server.js"]
|