Skip to content

Commit

Permalink
fix: 도커 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seokkkkkk committed Jul 17, 2024
1 parent 3fb7a8f commit bc8b6f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
15 changes: 6 additions & 9 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# Stage 1: Build the React app
FROM node:lts AS build

WORKDIR /app

COPY package.json package-lock.json ./
COPY package.json .

RUN npm install
RUN npm i

COPY . .

RUN npm run build

# Stage 2: Serve with Nginx
FROM nginx:stable-alpine

# Remove default Nginx configuration and copy custom config
# nginx의 기본 설정을 삭제하고 앱에서 설정한 파일을 복사
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx

# Copy built files to Nginx
# 위 스테이지에서 생성한 빌드 결과를 nginx의 샘플 앱이 사용하던 폴더로 이동
COPY --from=build /app/build /usr/share/nginx/html

# Expose HTTP port
EXPOSE 80

# Run Nginx
CMD ["nginx", "-g", "daemon off;"]
# nginx 실행
CMD [ "nginx", "-g", "daemon off;" ]
11 changes: 4 additions & 7 deletions conf/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
server {
listen 80;
server_name syluv.store www.syluv.store;

location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
}

0 comments on commit bc8b6f2

Please sign in to comment.