mirror of https://github.com/buster-so/buster.git
46 lines
850 B
Docker
46 lines
850 B
Docker
|
# Build stage
|
||
|
FROM node:20-alpine AS builder
|
||
|
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Copy package files
|
||
|
COPY package*.json ./
|
||
|
|
||
|
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 ./
|
||
|
|
||
|
# 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"]
|