-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (28 loc) · 988 Bytes
/
Dockerfile
File metadata and controls
36 lines (28 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM python:3.12-slim-bookworm
# 작업 환경 변수 설정
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV TZ=ETC/UTC
# 런타임에 필요한 시스템 패키지 설치
# 타임존 설정을 위해 tzdata는 포함합니다.
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
tzdata \
curl \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 이미지 내 작업 디렉토리 설정
WORKDIR /app
# requirements.txt 복사 및 의존성 패키지 설치
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# 애플리케이션 소스 코드 복사
COPY app/ ./app/
# Non-root 사용자 생성 및 설정
RUN useradd --system --create-home appuser && \
chown -R appuser:appuser /app
USER appuser
# 포트 설정
EXPOSE 8004
# 서비스 기동
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8004", "--log-level", "info", "--access-log"]