-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile.backend
More file actions
35 lines (26 loc) · 1.09 KB
/
Copy pathDockerfile.backend
File metadata and controls
35 lines (26 loc) · 1.09 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
# syntax=docker/dockerfile:1
FROM python:3.11-slim
# Build-time DNS fix for environments with IPv6 issues (WSL2, certain CI systems)
# Ensures pip install works even if the container's DNS is broken
ARG PIP_INDEX_URL=https://pypi.org/simple/
WORKDIR /app
# Install system dependencies — cached separately from code changes
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
libffi-dev \
libjpeg-dev \
libopenjp2-7 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies before copying code (better layer cache)
COPY backend/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --timeout 120 -r requirements.txt
# Copy backend source code
COPY backend/ /app/
# Create required directories
RUN mkdir -p /app/data/sample /app/data/professionals /app/bin
EXPOSE 8001
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/api/health')" || exit 1
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8001"]