-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (52 loc) · 1.63 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (52 loc) · 1.63 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
FROM python:3.13-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV BASE_DIR /app
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
# Install system dependencies (including libraries needed for PyTorch and curl for health checks)
RUN apt-get update && apt-get install -y --no-install-recommends \
netcat-traditional \
curl \
gcc \
g++ \
build-essential \
libc6-dev \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set work directory
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install PyTorch with CPU-only support for reliability
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Copy project
COPY . .
# Add explicit permissions and fix module access
RUN mkdir -p /app/data/models
RUN touch /app/data/error.txt && chmod 666 /app/data/error.txt
# Make entrypoint scripts executable
RUN chmod +x /app/entrypoint.sh
RUN chmod +x /app/entrypoint.prod.sh
RUN chmod +x /app/docker-entrypoint-wrapper.sh
# Create necessary directories
RUN mkdir -p /app/media/profile_pics
RUN mkdir -p /app/media/xrays
RUN mkdir -p /app/data/models
COPY ./data/ /app/data/
RUN mkdir -p /app/staticfiles
RUN mkdir -p /app/prometheus
# Set permissions
RUN chmod -R 755 /app/media
RUN chmod -R 755 /app/staticfiles
RUN chmod -R 755 /app/data
RUN chmod -R 755 /app/prometheus
# Use the wrapper as the entrypoint
ENTRYPOINT ["/app/docker-entrypoint-wrapper.sh"]