-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (25 loc) · 785 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
# Build stage
FROM node:16.13.2-alpine as build
# Our working directory
WORKDIR /app
# Install the dependencies
COPY package*.json yarn.lock ./
# Install the dependencies
RUN yarn install
# --frozen-lockfile --production
# Copy the entire project directory into the container
COPY . .
# Build the Next.js application
RUN yarn build
# Release step
FROM nginx:1.21.5-alpine as release
# Removing the default Nginx configuration
RUN rm -rf /etc/nginx/conf.d/*
# Built Next.js files from the previous stage to the Nginx server root
COPY --from=build /app/.next /usr/share/nginx/html/
# Custom Nginx configuration file
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80 for Nginx
EXPOSE 80
# Start Nginx when the container starts
CMD ["nginx", "-g", "daemon off;"]