Files
HyeongBaeYangandClaude Opus 5.5 f0e657b6d4 feat: deploy to AWS o2o-platform-plagiarism via GitHub Actions
main push builds the runtime image (linux/amd64), pushes it to ECR
plagiarism-api:<sha> and runs SSM Deploy-plagiarism, which swaps the
container and rolls back if it is not healthy. Python and pip versions
are pinned to the King production image so the joblib model keeps loading.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-27 13:57:16 +09:00

42 lines
1.1 KiB
Docker

# 3.13.2: King 서버 운영 이미지와 같은 Python (constraints.txt와 함께 joblib 모델 호환 유지)
FROM python:3.13.2-slim AS base
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONPATH=/app \
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 constraints.txt ./
RUN pip install -r requirements.txt -c constraints.txt
COPY app ./app
COPY data ./data
COPY scripts ./scripts
FROM base AS test
RUN pip install "pytest>=8.0"
COPY tests ./tests
CMD ["pytest", "tests", "-q"]
FROM base AS runtime
# 코퍼스 업로드 디렉토리는 볼륨 마운트 권장
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"]