File tree Expand file tree Collapse file tree 5 files changed +96
-7
lines changed Expand file tree Collapse file tree 5 files changed +96
-7
lines changed Original file line number Diff line number Diff line change 1+ # docker-compose.yml
2+ version : ' 3.8'
3+
4+ services :
5+ frontend :
6+ image : liboost/frontend-index-server
7+ build :
8+ context : .
9+ dockerfile : ./frontend/dockerfile
10+ depends_on :
11+ # - backend
12+ - nginx
13+
14+ # backend:
15+ # build:
16+ # context: ./backend
17+ # volumes:
18+ # - ./docker-compose.backend.yml:/app/docker-compose.backend.yml # backend의 하위 구성 포함
19+ # - .:/app # 소스 코드 전체 마운트
20+ # - yarn-lock:/app/yarn.lock # yarn.lock 파일을 공통 볼륨으로 마운트
21+ # command: docker-compose -f /app/docker-compose.backend.yml up
22+ # depends_on:
23+ # - nginx
24+
25+ nginx :
26+ image : nginx:latest
27+ ports :
28+ - " 80:80"
29+ volumes :
30+ - ./nginx:/etc/nginx # Nginx 설정 파일을 컨테이너에 마운트
31+
32+
33+
Original file line number Diff line number Diff line change 1+ # 1. 베이스 이미지 설정
2+ FROM node:20-alpine AS builder
3+
4+ # 2. 작업 디렉토리 생성 및 이동
5+ WORKDIR /app
6+
7+ COPY yarn.lock ./
8+
9+ # 3. package.json 및 yarn.lock 파일 복사
10+ COPY ./frontend/package.json ./
11+
12+ # 4. 의존성 설치
13+ RUN yarn install
14+
15+ # 5. 소스 코드 복사 및 빌드
16+ COPY ./frontend .
17+
18+ RUN yarn build
19+
20+ # 6. 실행 환경 설정
21+ FROM node:20-alpine AS runtime
22+
23+ WORKDIR /app
24+
25+ # 7. 빌드 결과물을 runtime 단계로 복사
26+ COPY --from=builder /app/.dist /app/vite.config.ts ./
27+
28+ COPY ./frontend/package.json ./
29+ COPY yarn.lock ./
30+ # 8. 의존성 설치 (runtime 필요 항목만 설치)
31+ RUN yarn install --production
32+
33+ EXPOSE 5173
34+ # 9. 서버 실행
35+ CMD ["yarn", "dev"]
Original file line number Diff line number Diff line change 44 "version" : " 0.0.0" ,
55 "type" : " module" ,
66 "scripts" : {
7- "dev" : " vite" ,
7+ "dev" : " vite --host 0.0.0.0 " ,
88 "build" : " vite build" ,
99 "lint" : " eslint ." ,
1010 "preview" : " vite preview" ,
1818 "react" : " ^18.3.1" ,
1919 "react-dom" : " ^18.3.1" ,
2020 "react-router-dom" : " ^6.27.0" ,
21- "styled-components" : " ^6.1.13"
21+ "styled-components" : " ^6.1.13" ,
22+ "@vitejs/plugin-react" : " ^4.3.3" ,
23+ "vite" : " ^5.4.10" ,
24+ "vite-plugin-svgr" : " ^4.3.0" ,
25+ "vite-tsconfig-paths" : " ^5.1.0"
2226 },
2327 "devDependencies" : {
2428 "@eslint/js" : " ^9.13.0" ,
2832 "@types/styled-components" : " ^5.1.34" ,
2933 "@typescript-eslint/eslint-plugin" : " ^8.14.0" ,
3034 "@typescript-eslint/parser" : " ^8.14.0" ,
31- "@vitejs/plugin-react" : " ^4.3.3" ,
3235 "eslint" : " ^9.13.0" ,
3336 "eslint-plugin-react-hooks" : " ^5.0.0" ,
3437 "eslint-plugin-react-refresh" : " ^0.4.14" ,
3538 "globals" : " ^15.11.0" ,
3639 "typescript" : " ^5.6.3" ,
37- "typescript-eslint" : " ^8.11.0" ,
38- "vite" : " ^5.4.10" ,
39- "vite-plugin-svgr" : " ^4.3.0" ,
40- "vite-tsconfig-paths" : " ^5.1.0"
40+ "typescript-eslint" : " ^8.11.0"
4141 }
4242}
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80;
3+ server_name localhost;
4+
5+ location / {
6+ proxy_pass http://frontend:5173; # 5173 포트로 포워딩
7+ proxy_set_header Host $host;
8+ proxy_set_header X-Real-IP $remote_addr;
9+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10+ proxy_set_header X-Forwarded-Proto $scheme;
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ # nginx.conf
2+
3+ events {
4+ worker_connections 1024 ;
5+ }
6+
7+ http {
8+ include conf.d/*.conf; # conf.d 디렉터리의 모든 .conf 파일을 포함
9+ }
You can’t perform that action at this time.
0 commit comments