11# 멀티 스테이지 빌드를 사용한 최적화된 Dockerfile
22
33# Stage 1: 빌드 스테이지
4- FROM python:3.10-slim as builder
4+ FROM python:3.10-slim AS builder
55
66# 빌드 인자 정의 (기본값: CPU)
77ARG BUILD_FOR=cpu
@@ -54,6 +54,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
5454 libxext6 \
5555 libxrender-dev \
5656 libgomp1 \
57+ curl \
5758 && rm -rf /var/lib/apt/lists/*
5859
5960# 비root 사용자 생성
@@ -70,13 +71,18 @@ COPY --from=builder /usr/local/bin /usr/local/bin
7071
7172# 애플리케이션 코드 복사
7273COPY echoshot_ai_server/ /app/echoshot_ai_server/
73- COPY weights/ /app/weights/
7474
75- # 모델 가중치 디렉토리 생성 (없는 경우)
76- RUN mkdir -p /app/echoshot_ai_server/tasks/weights && \
77- if [ -d /app/weights ]; then \
78- cp -r /app/weights/* /app/echoshot_ai_server/tasks/weights/ 2>/dev/null || true; \
79- fi
75+ # 모델 가중치 디렉토리 생성 및 모델 파일 다운로드
76+ RUN mkdir -p /app/weights /app/echoshot_ai_server/tasks/weights && \
77+ echo "Downloading model files..." && \
78+ curl -L -o /app/weights/FSRCNN_x2.pb \
79+ https://github.com/Saafke/FSRCNN_Tensorflow/raw/master/models/FSRCNN_x2.pb && \
80+ curl -L -o /app/weights/EDSR_x2.pb \
81+ https://github.com/Saafke/EDSR_Tensorflow/raw/master/models/EDSR_x2.pb && \
82+ curl -L -o /app/weights/RealESRGAN_x4plus.pth \
83+ https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth && \
84+ cp -r /app/weights/* /app/echoshot_ai_server/tasks/weights/ && \
85+ echo "Model files downloaded successfully"
8086
8187# 소유권 변경
8288RUN chown -R worker:worker /app
0 commit comments