forked from LondheShubham153/tws-e-commerce-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (29 loc) · 801 Bytes
/
Dockerfile
File metadata and controls
41 lines (29 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Stage 1: Development/Build Stage
FROM node:18-alpine AS builder
# Set working directory
WORKDIR /app
# Install necessary build dependencies
RUN apk add --no-cache python3 make g++
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy all project files
COPY . .
# Build the Next.js application
RUN npm run build
# Stage 2: Production Stage
FROM node:18-alpine AS runner
# Set working directory
WORKDIR /app
# Copy necessary files from builder stage
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
# Expose the port the app runs on
EXPOSE 3000
# Command to run the application
CMD ["node", "server.js"]