-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
39 lines (30 loc) · 923 Bytes
/
Dockerfile
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
# Use node:18-alpine as the base image
FROM node:18-alpine AS base
# Set the working directory
WORKDIR /app
# Install dependencies
FROM base AS deps
COPY package.json ./
RUN npm config set registry 'https://registry.npmmirror.com/'
RUN npm install
# Build the application
FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
# Prepare the runner stage
FROM node:18-alpine AS runner
# Set the working directory
WORKDIR /app
# Copy the necessary files from the builder stage
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server
# Expose the application port
EXPOSE 3000
# Set environment variables
ENV HOSTNAME=0.0.0.0 PORT=3000
# Start the application
CMD ["node", "server.js"]