-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
72 lines (59 loc) · 2.07 KB
/
Copy pathDockerfile.dev
File metadata and controls
72 lines (59 loc) · 2.07 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Development Dockerfile with Hot Reload
# Optimized for fast iteration and debugging
FROM python:3.13-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1 \
TF_CPP_MIN_LOG_LEVEL=2 \
DEEPFACE_HOME=/tmp/.deepface \
PORT=8080
WORKDIR /app
# Install system dependencies and dev tools
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libgl1 \
curl \
vim \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Create constraint file
RUN echo "keras<3.0" > /tmp/constraints.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -c /tmp/constraints.txt "numpy>=2.2.5" && \
pip install --no-cache-dir -c /tmp/constraints.txt opencv-python-headless>=4.8.0 && \
pip install --no-cache-dir -c /tmp/constraints.txt tensorflow-cpu==2.21.0 && \
pip install --no-cache-dir --no-deps deepface==0.0.98 && \
pip install --no-cache-dir -c /tmp/constraints.txt lightphe lightdsa && \
pip install --no-cache-dir -c /tmp/constraints.txt -r requirements.txt && \
pip uninstall -y opencv-python opencv-contrib-python 2>/dev/null || true && \
pip install --no-cache-dir -c /tmp/constraints.txt --force-reinstall opencv-python-headless>=4.8.0
# Install development tools
RUN pip install --no-cache-dir \
pytest==8.0.0 \
pytest-asyncio==0.23.5 \
pytest-cov==4.1.0 \
black==24.2.0 \
ruff==0.2.2 \
mypy==1.8.0 \
ipython==8.21.0 \
debugpy==1.8.1 \
watchfiles==0.21.0
# Copy application code
COPY . .
# Create upload directory
RUN mkdir -p /app/uploads /tmp/.deepface
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl --fail http://localhost:8080/api/v1/health || exit 1
# Start with hot reload
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--reload", "--reload-dir", "/app"]