-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.render
More file actions
41 lines (29 loc) · 1.15 KB
/
Dockerfile.render
File metadata and controls
41 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
37
38
39
40
41
# Dockerfile.render
# Optimised for Render free tier:
# - CPU-only PyTorch (saves ~600 MB vs full torch wheel)
# - No GPU, no Celery, no MLflow
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 curl \
&& rm -rf /var/lib/apt/lists/*
# CPU-only PyTorch — much smaller than the default CUDA wheel (~600 MB saved).
RUN pip install torch==2.3.1+cpu torchvision==0.18.1+cpu \
--index-url https://download.pytorch.org/whl/cpu
COPY requirements/render.txt requirements/render.txt
RUN pip install --no-cache-dir -r requirements/render.txt
COPY api/ ./api/
COPY model/ ./model/
COPY data/ ./data/
COPY workers/ ./workers/
RUN mkdir -p checkpoints reports/xai monitoring/logs
RUN adduser --disabled-password --gecos "" appuser && \
chown -R appuser:appuser /app
USER appuser
EXPOSE 10000
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:10000/health || exit 1
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "10000"]