Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +1 -10
Dockerfile
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
-
# Use a lightweight base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libglib2.0-0 \
|
| 7 |
libgl1-mesa-glx \
|
|
@@ -11,28 +9,21 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
git \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# Set working directory
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
# Create a non-root user to run the application
|
| 18 |
RUN useradd -m appuser
|
| 19 |
RUN chown -R appuser:appuser /app
|
| 20 |
|
| 21 |
-
# Create cache directories with proper permissions
|
| 22 |
RUN mkdir -p /tmp/matplotlib /tmp/torchxrayvision
|
| 23 |
RUN chown -R appuser:appuser /tmp/matplotlib /tmp/torchxrayvision
|
| 24 |
|
| 25 |
-
# Copy project files
|
| 26 |
COPY --chown=appuser:appuser . .
|
| 27 |
|
| 28 |
-
# Install Python dependencies
|
| 29 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
-
# Switch to non-root user
|
| 32 |
USER appuser
|
| 33 |
|
| 34 |
-
# Expose the port used by FastAPI
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
-
# Start the API
|
| 38 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y \
|
| 4 |
libglib2.0-0 \
|
| 5 |
libgl1-mesa-glx \
|
|
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
| 12 |
WORKDIR /app
|
| 13 |
|
|
|
|
| 14 |
RUN useradd -m appuser
|
| 15 |
RUN chown -R appuser:appuser /app
|
| 16 |
|
|
|
|
| 17 |
RUN mkdir -p /tmp/matplotlib /tmp/torchxrayvision
|
| 18 |
RUN chown -R appuser:appuser /tmp/matplotlib /tmp/torchxrayvision
|
| 19 |
|
|
|
|
| 20 |
COPY --chown=appuser:appuser . .
|
| 21 |
|
|
|
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
|
|
|
| 24 |
USER appuser
|
| 25 |
|
|
|
|
| 26 |
EXPOSE 7860
|
| 27 |
|
|
|
|
| 28 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 29 |
+
|