본문 바로가기
web

프로젝트 생성 방식에 따른 react 빌드 산출물 위치

by seohan1010 2025. 12. 25.

 

 

 

 

 

 

 




Vite: dist / CRA: build (create react app)

# ===== 1. build stage =====
FROM node:18.19.1-alpine AS build
WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY . .
RUN npm run build


RUN ls
RUN pwd

# ===== 2. runtime stage =====
FROM nginx:1.27-alpine

# 기본 설정 제거
RUN rm /etc/nginx/conf.d/default.conf

# React 빌드 결과 복사
# Vite: dist / CRA: build (create react app)
COPY --from=build /app/build /usr/share/nginx/html

# ⭐ 수정한 nginx.conf 적용
COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 3001
CMD ["nginx", "-g", "daemon off;"]