-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.backend
More file actions
43 lines (30 loc) · 992 Bytes
/
Copy pathDockerfile.backend
File metadata and controls
43 lines (30 loc) · 992 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
37
38
39
40
41
42
43
# syntax=docker/dockerfile:1
# 베이스 이미지
FROM python:3.13-slim
# 파이썬 기본 설정
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 작업 디렉토리
WORKDIR /app
# 빌드에 필요한 최소 시스템 패키지
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Poetry 설치
RUN pip install --no-cache-dir poetry
# 의존성 정의 파일만 먼저 복사 (레이어 캐시용)
COPY pyproject.toml poetry.lock* ./
RUN poetry config virtualenvs.create false \
&& poetry install --no-root --only main --no-interaction --no-ansi
# → fastapi, sqlalchemy, bigquery client 등 공통 deps만 설치
# 앱 코드 전체 복사
COPY . .
# 일반 유저로 실행
RUN useradd -m insightbee && chown -R insightbee /app
USER insightbee
# 작업 디렉토리 변경
WORKDIR /app/apps/backend
# Cloud Run 포트
ENV PORT=8080
# FastAPI 실행
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]