47 lines
1.1 KiB
Docker
47 lines
1.1 KiB
Docker
# deployment/container/Dockerfile
|
|
# Restaurant Collection Service Image
|
|
ARG BASE_IMAGE=restaurant-api-base:latest
|
|
FROM ${BASE_IMAGE}
|
|
|
|
# 메타데이터
|
|
LABEL maintainer="admin@example.com"
|
|
LABEL version="1.0.0"
|
|
LABEL description="카카오 API 기반 음식점 수집 서비스"
|
|
|
|
# root로 전환 (패키지 설치용)
|
|
USER root
|
|
|
|
# 환경 변수 설정
|
|
ENV HOME=/home/appuser \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
# Python 의존성 파일 복사 및 설치
|
|
COPY app/requirements.txt /app/
|
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
# 애플리케이션 소스 복사
|
|
COPY app/main.py /app/
|
|
|
|
# 데이터 디렉토리 생성 및 권한 설정
|
|
RUN mkdir -p /app/data \
|
|
&& chown -R appuser:appuser /app \
|
|
&& chmod -R 755 /app
|
|
|
|
# 비root 사용자로 전환
|
|
USER appuser
|
|
|
|
# 작업 디렉토리 설정
|
|
WORKDIR /app
|
|
|
|
# 포트 노출
|
|
EXPOSE 18000
|
|
|
|
# 헬스체크
|
|
HEALTHCHECK --interval=30s --timeout=15s --start-period=30s --retries=3 \
|
|
CMD curl -f http://localhost:18000/health || exit 1
|
|
|
|
# 애플리케이션 실행
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "18000", "--log-level", "info"]
|
|
|