forked from LikeLion-at-DGU/2024_fall_festival_front
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (27 loc) · 783 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
# Base image with Node.js
FROM node:18-alpine as build
# Set working directory
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
RUN npm install
# Copy all files
COPY . .
# Build the application
RUN npm run build
# Production image for Nginx
FROM nginx:alpine
# Install Node.js in Nginx container
RUN apk add --no-cache nodejs npm
# Copy built application
COPY --from=build /app/dist /usr/share/nginx/html
# Copy Node.js server files
COPY --from=build /app/node_modules /app/node_modules
# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx config
COPY ./nginx.conf /etc/nginx/conf.d
# Expose ports
EXPOSE 80
# Run both Nginx and Node.js server
CMD ["sh", "-c", "node /app/server.cjs & nginx -g 'daemon off;'"]