-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
38 lines (28 loc) · 911 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
# Stage 1: Building the application
FROM node:20-alpine as builder
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install -g pnpm
RUN pnpm install
# Copy the rest of your application code
COPY . .
# Build the application
RUN pnpm run build
# Stage 2: Serve the application
FROM node:20-alpine as runner
LABEL org.opencontainers.image.source="https://github.com/CEDT-Chula/cedt-community"
# Set the working directory
WORKDIR /app
# Copy over the built artifacts from the builder stage
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
# Expose the port Next.js runs on
EXPOSE 3000
# Set the command to start the node server
CMD ["npm", "start"]