diff --git a/docker-compose.yml b/docker-compose.yml index 9d49b1b6a..616ad35ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,9 @@ services: ports: - "3000:3000" environment: - API_URL: http://api:3001 + - NODE_ENV=production + env_file: + - ./web/.env depends_on: - api diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 000000000..b321eab81 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,50 @@ +# Build stage +FROM node:20-alpine AS builder + +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Copy environment variables for build +COPY .env ./ +COPY next.config.mjs ./ + + +# Install dependencies +RUN npm ci + +# Copy source code +COPY . . + +# Build the Next.js application +RUN npm run build + +# Production stage +FROM node:20-alpine AS runner + +WORKDIR /app + +# Set to production environment +ENV NODE_ENV=production + +# Copy necessary files from builder +COPY --from=builder /app/public ./public +COPY --from=builder /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/next.config.mjs ./ +# Copy environment files +COPY --from=builder /app/.env ./ + +# Expose the port your app runs on +EXPOSE 3000 + +# Add tini for proper signal handling +RUN apk add --no-cache tini + +# Use tini as entrypoint +ENTRYPOINT ["/sbin/tini", "--"] + +# Start the application +CMD ["npm", "start"] diff --git a/web/package.json b/web/package.json index 5ad446e51..e944198ae 100644 --- a/web/package.json +++ b/web/package.json @@ -10,7 +10,7 @@ "cy:run": "npx cypress run --browser chrome" }, "engines": { - "node": ">=22.0.0" + "node": ">=20.0.0" }, "dependencies": { "@ant-design/nextjs-registry": "^1.0.2",