-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (32 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (32 loc) · 1.1 KB
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
# ---- Builder image ----
FROM python:3.11-slim AS builder
# ---- Environment ----
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
# ---- System deps (build-only) ----
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# ---- Workdir ----
WORKDIR /app
# ---- Install Python deps first (better caching) ----
COPY requirements.txt .
COPY services/datafeed/requirements.txt services/datafeed/requirements.txt
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt -r services/datafeed/requirements.txt
# ---- Runtime image ----
FROM python:3.11-slim AS runtime
# ---- Environment ----
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# ---- Workdir ----
WORKDIR /app
# ---- Copy deps ----
COPY --from=builder /usr/local /usr/local
# ---- Copy only required app code ----
COPY src ./src
COPY services/__init__.py ./services/__init__.py
COPY services/datafeed ./services/datafeed
# ---- Default command (local dev) ----
CMD ["python", "src/manage.py", "runserver", "0.0.0.0:8080"]