-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (29 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
36 lines (29 loc) · 1.15 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
# ---- Base ----
FROM python:3.11-slim
# Prevent .pyc, force unbuffered logs
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
# Workdir
WORKDIR /app
# ---- System deps (build + minimal runtime) ----
# If you add scientific libs later (numpy/scipy/astropy), keep build-essential.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# ---- Python deps (cache-friendly) ----
# (This layer only invalidates when requirements.txt changes)
COPY requirements.txt .
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install -r requirements.txt
# ---- App code ----
COPY . .
# ---- Runtime config ----
EXPOSE 5001
# Optional: make Gunicorn a tad more resilient in containers
# - gthread works well for Flask + light I/O
# - --timeout 30 avoids premature kills on cold starts
# - --worker-tmp-dir /dev/shm avoids tmpfs issues on some hosts
CMD ["gunicorn", "-w", "2", "-k", "gthread", "--threads", "4", "--timeout", "30", "--worker-tmp-dir", "/dev/shm", "--log-level", "info", "-b", "0.0.0.0:5001", "nova:app"]