Update Dockerfile
Browse files- Dockerfile +25 -10
Dockerfile
CHANGED
|
@@ -20,22 +20,37 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 20 |
&& apt-get clean \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
-
# Python environment configuration
|
| 24 |
RUN ln -sf /usr/bin/python3 /usr/bin/python && \
|
| 25 |
curl -sS https://bootstrap.pypa.io/get-pip.py | python3 && \
|
| 26 |
python3 -m pip install --no-cache-dir pip==23.3.1 setuptools==69.0.3 wheel==0.42.0
|
| 27 |
|
|
|
|
| 28 |
WORKDIR /app
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
COPY requirements.txt
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
RUN
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
&& apt-get clean \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
|
|
|
| 23 |
RUN ln -sf /usr/bin/python3 /usr/bin/python && \
|
| 24 |
curl -sS https://bootstrap.pypa.io/get-pip.py | python3 && \
|
| 25 |
python3 -m pip install --no-cache-dir pip==23.3.1 setuptools==69.0.3 wheel==0.42.0
|
| 26 |
|
| 27 |
+
# Application directory structure
|
| 28 |
WORKDIR /app
|
| 29 |
+
RUN mkdir -p /app/cache /app/src && \
|
| 30 |
+
chmod 777 /app/cache
|
| 31 |
|
| 32 |
+
# Dependencies installation (two-stage for better caching)
|
| 33 |
+
COPY requirements.txt /app/src/
|
| 34 |
+
WORKDIR /app/src
|
| 35 |
+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
| 36 |
|
| 37 |
+
# Application code
|
| 38 |
+
COPY . /app/src/
|
| 39 |
|
| 40 |
+
# Runtime environment
|
| 41 |
+
ENV MODEL_PATH=/app/cache \
|
| 42 |
+
PYTHONPATH=/app/src:$PYTHONPATH \
|
| 43 |
+
OMP_NUM_THREADS=1 \
|
| 44 |
+
MKL_NUM_THREADS=1
|
| 45 |
|
| 46 |
+
# # GPU verification with comprehensive diagnostics
|
| 47 |
+
RUN python3 -c 'import torch; \
|
| 48 |
+
assert torch.cuda.is_available(), "CUDA unavailable"; \
|
| 49 |
+
print(f"PyTorch: {torch.__version__}"); \
|
| 50 |
+
print(f"CUDA: {torch.version.cuda}"); \
|
| 51 |
+
print(f"GPU: {torch.cuda.get_device_name()}"); \
|
| 52 |
+
print(f"Arch: {torch.cuda.get_device_capability()}");'
|
| 53 |
+
|
| 54 |
+
EXPOSE 8000
|
| 55 |
+
|
| 56 |
+
CMD ["python", "server.py"]
|