mirror of https://github.com/buster-so/buster.git
dockerfile for web
This commit is contained in:
parent
11b4b929c0
commit
5f612fbcf7
|
@ -32,7 +32,9 @@ services:
|
|||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
API_URL: http://api:3001
|
||||
- NODE_ENV=production
|
||||
env_file:
|
||||
- ./web/.env
|
||||
depends_on:
|
||||
- api
|
||||
|
||||
|
|
|
@ -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"]
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue