INIT(api): add FastAPI application

- Initialize FastAPI project structure
- Add basic API configuration
This commit is contained in:
2025-12-01 14:34:20 +09:00
commit 615fe6e574
19 changed files with 1418 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
# Production Dockerfile for Joossam FastAPI OMR Grading Service
FROM python:3.11-slim AS base
# 시스템 의존성 설치 (OpenCV용)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Python 의존성 설치
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 애플리케이션 코드 복사
COPY . .
# 비루트 사용자 생성 및 전환
RUN addgroup --system --gid 1001 appgroup && \
adduser --system --uid 1001 --gid 1001 appuser && \
chown -R appuser:appgroup /app
USER appuser
EXPOSE 8000
ENV HOST=0.0.0.0
ENV PORT=8000
# 헬스체크
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]