diff --git a/.gitignore b/.gitignore index 12aa9f8..6d1f9ba 100644 --- a/.gitignore +++ b/.gitignore @@ -48,10 +48,7 @@ poetry.lock .DS_Store Thumbs.db -# ---- Docker ---- -/docker-compose.override.yml -**/.dockerignore -**/Dockerfile + # ---- Tests / Coverage ---- htmlcov/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..386fc23 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.10-slim + +# 1. 작업 디렉토리 설정 +WORKDIR /app + +# 2. requirements.txt만 먼저 복사 (캐시 활용) +COPY requirements.txt . + +# 3. 패키지 설치 +RUN pip install --no-cache-dir -r requirements.txt + +# 4. 실제 코드 복사 (변경 가능성이 높기 때문에 나중에 복사해야 pip 캐시 유지됨) +COPY app ./app + +# 5. PYTHONPATH 환경변수 설정 (모듈 import를 위해) +ENV PYTHONPATH=/app + +# 6. FastAPI 서버 실행 +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/app/main.py b/app/main.py index a59abcc..40d4794 100644 --- a/app/main.py +++ b/app/main.py @@ -113,14 +113,9 @@ async def sentences_endpoint(payload: SentencesRequest = Body(...)): raise HTTPException(status_code=400, detail="text 또는 paragraphs 중 하나는 필요합니다.") # 전체 원문 - whole_text = payload.text or " ".join(payload.paragraphs or []) + whole_text = payload.text # 문장 분리 - if payload.paragraphs: - sents = [] - for para in payload.paragraphs: - sents.extend(split_sentences(para)) - else: - sents = split_sentences(whole_text) + sents = split_sentences(whole_text) return SentencesResponse(text=whole_text, sentences=sents)