문서작업

This commit is contained in:
2026-02-02 23:13:28 +09:00
parent 84746d41b8
commit 6d673e06ce
8 changed files with 531 additions and 179 deletions

View File

@@ -1,31 +1,34 @@
# 1단계: 빌드 (Node.js)
FROM node:20-alpine AS build
WORKDIR /app
# 1. Frontend Build Stage
FROM node:20-alpine AS frontend-build
WORKDIR /app/frontend
COPY package*.json ./
RUN rm -f package-lock.json && npm install
RUN npm install
COPY . .
RUN npm run build
# 2단계: 실행 (Nginx)
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
# 2. Backend & Serving Stage
FROM python:3.9-slim
# 기존 기본 파일 제거 및 빌드 결과물 복사
RUN rm -rf ./*
COPY --from=build /app/dist .
# Set working directory
WORKDIR /app
# React Router SPA 라우팅을 위한 Nginx 설정 적용
RUN echo 'server { \
listen 80; \
location / { \
root /usr/share/nginx/html; \
index index.html index.htm; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
# Install system dependencies (if needed for TA-Lib or others)
# RUN apt-get update && apt-get install -y gcc ...
# 환경변수 포트 노출
# Copy backend requirements
COPY ./backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY ./backend ./backend
# Copy frontend build artifacts to backend static folder
COPY --from=frontend-build /app/frontend/dist ./backend/static
# Environment variables
ENV PORT=80
EXPOSE 80
# Nginx 서버 실행
CMD ["nginx", "-g", "daemon off;"]
# Run FastAPI server
# Assuming main.py is in backend folder and app object is named 'app'
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "80"]