-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from sayyyho/dev
Fix: nginx.conf 및 dockerfile 에러 수정
- Loading branch information
Showing
2 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
# Base image with the latest Node.js version | ||
FROM node:latest as build | ||
# 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 | ||
RUN npm install --production | ||
|
||
# Copy the rest of the application files | ||
# Copy all files | ||
COPY . . | ||
|
||
# Build the application (if needed) | ||
# Build the application | ||
RUN npm run build | ||
|
||
# Use Nginx for production | ||
# Production image for Nginx | ||
FROM nginx:alpine | ||
|
||
# Copy built application | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
# Remove default Nginx configuration and add custom configuration | ||
# Install Node.js in Nginx container | ||
RUN apk add --no-cache nodejs npm | ||
|
||
# Copy Node.js server files | ||
COPY --from=build /app/server.cjs /app/server.cjs | ||
|
||
# Remove default nginx config | ||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY ./nginx.conf /etc/nginx/conf.d/ | ||
|
||
# Copy custom nginx config | ||
COPY ./nginx.conf /etc/nginx/conf.d | ||
|
||
# Expose ports | ||
EXPOSE 80 3000 | ||
|
||
# Start Nginx server | ||
CMD ["nginx", "-g", "daemon off;"] | ||
# Run both Nginx and Node.js server | ||
CMD ["sh", "-c", "node /app/server.cjs & nginx -g 'daemon off;'"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters