-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (36 loc) 路 1.19 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (36 loc) 路 1.19 KB
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
42
43
44
45
46
47
48
49
50
51
# Specify a base image
FROM node:20-alpine as build
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install --legacy-peer-deps
# Copy the rest of the application files
COPY ./ ./
# Build the Next.js application
RUN npm run build
# Use a multi-stage build to keep the final image small
FROM nginx:alpine
# Install supervisor and Node.js
RUN apk add --no-cache supervisor nodejs npm
# Set the working directory
WORKDIR /app
# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
# Copy the built Next.js application from the previous stage
COPY --from=build /app/.next/static /usr/share/nginx/html/_next/static
COPY --from=build /app/public /usr/share/nginx/html
# Copy the source files for the Node server and Next.js app
COPY server.js ./server.js
COPY package*.json ./
COPY --from=build /app/.next ./.next
COPY --from=build /app/node_modules ./node_modules
# Copy the supervisord configuration
COPY supervisord.conf /etc/supervisord.conf
# Expose ports
EXPOSE 80 3001 3030
# Create log directory
RUN mkdir -p /var/log
# Command to run supervisord
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]