Skip to content

Commit

Permalink
Merge pull request #60 from sayyyho/dev
Browse files Browse the repository at this point in the history
Fix: 도커파일 내 node 실행 로직 추가
  • Loading branch information
sayyyho authored Aug 29, 2024
2 parents 88f8a66 + 998aaf6 commit cb48b31
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Base image with Node.js
# Base image
FROM node:18-alpine as build

# Set working directory
Expand All @@ -14,20 +14,19 @@ COPY . .
# Build the application
RUN npm run build

# Production image for Nginx
# Production image
FROM nginx:alpine

# Make sure the app directory is created in this stage
WORKDIR /app

COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/server.cjs /app

# Node.js 설치 및 의존성 설치
RUN apk add --no-cache nodejs npm
COPY . /app
RUN npm install --production

RUN rm /etc/nginx/conf.d/default.conf
COPY ./nginx.conf /etc/nginx/conf.d

# Expose ports
# Expose ports for Nginx and Node.js
EXPOSE 80 3000

# Start Nginx and Node.js server
CMD ["sh", "-c", "node /app/server.cjs & nginx -g 'daemon off;'"]

0 comments on commit cb48b31

Please sign in to comment.