32 lines
850 B
Docker
32 lines
850 B
Docker
FROM python:3.13-slim
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
HOST=0.0.0.0 \
|
|
PORT=8000
|
|
|
|
# kiwipiepy/scikit-learn/torch 빌드에 필요한 시스템 패키지
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install -r requirements.txt
|
|
|
|
COPY app ./app
|
|
COPY data ./data
|
|
|
|
# 코퍼스 업로드 디렉토리는 볼륨 마운트 권장
|
|
VOLUME ["/app/data/reference"]
|
|
|
|
EXPOSE 8000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
|
CMD python -c "import os, urllib.request; urllib.request.urlopen(f'http://localhost:{os.environ.get(\"PORT\", 8000)}/v1/health').read()" || exit 1
|
|
|
|
# .env의 HOST/PORT/LOG_LEVEL 따라 동작
|
|
CMD ["python", "-m", "app.main"]
|