ci: add multi-stage build to compile frontend automatically
Build and Deploy / deploy (push) Successful in 16s
Build and Deploy / deploy (push) Successful in 16s
This commit is contained in:
1 parent
a2626f6cc1
commit
42008079db
1 file changed
+22
-3
+22
-3
@@ -1,3 +1,21 @@
|
|||||||
|
# ==========================================
|
||||||
|
# 1단계: 프론트엔드 (Vue 3 + Vuetify) 자동 빌드
|
||||||
|
# ==========================================
|
||||||
|
FROM node:20-slim AS frontend-builder
|
||||||
|
|
||||||
|
WORKDIR /frontend-build
|
||||||
|
|
||||||
|
# 의존성 캐시 활용
|
||||||
|
COPY frontend/package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# 소스코드 복사 및 프로덕션 빌드
|
||||||
|
COPY frontend/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 2단계: 백엔드 (FastAPI) 및 최종 프로덕션 런타임
|
||||||
|
# ==========================================
|
||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -12,11 +30,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
COPY backend/requirements.txt .
|
COPY backend/requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 백엔드 및 빌드된 프론트엔드 정적 파일 복사
|
# 백엔드 소스코드 복사
|
||||||
COPY backend/ ./backend/
|
COPY backend/ ./backend/
|
||||||
COPY frontend/dist/ ./frontend/dist/
|
|
||||||
COPY main.py run.py ./
|
COPY main.py run.py ./
|
||||||
|
|
||||||
|
# 1단계에서 빌드된 프론트엔드 dist 복사 (완전 자동 통합)
|
||||||
|
COPY --from=frontend-builder /frontend-build/dist/ ./frontend/dist/
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
ENV TRANSMISSION_HOST=127.0.0.1
|
ENV TRANSMISSION_HOST=127.0.0.1
|
||||||
@@ -24,4 +44,3 @@ ENV TRANSMISSION_PORT=9091
|
|||||||
ENV DOWNLOADS_DIR=/downloads
|
ENV DOWNLOADS_DIR=/downloads
|
||||||
|
|
||||||
CMD ["python", "run.py"]
|
CMD ["python", "run.py"]
|
||||||
|
|
||||||
Reference in new issue
Block a user