Skip to content

Commit

Permalink
Merge pull request #67 from KakaoTech-BootCamp-Team-2/sayyyho-patch-1
Browse files Browse the repository at this point in the history
Update Dockerfile
  • Loading branch information
sayyyho authored Aug 29, 2024
2 parents 80be116 + f664305 commit baa17e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ RUN npm install
COPY . .

# Build the application
RUN npx vite build # 'npx vite build'로 빌드 실행
RUN npm run build

# Production image for Nginx
FROM nginx:alpine

# Copy built application
COPY --from=build /app/dist /usr/share/nginx/html

# 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/server.cjs /app/server.cjs
COPY --from=build /app/node_modules /app/node_modules # Ensure node_modules is copied
COPY --from=build /app/server.js /app/server.js
COPY --from=build /app/node_modules /app/node_modules

# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf
Expand All @@ -37,4 +37,4 @@ COPY ./nginx.conf /etc/nginx/conf.d
EXPOSE 80 3000

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

0 comments on commit baa17e3

Please sign in to comment.