Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -23
Dockerfile
CHANGED
@@ -1,31 +1,26 @@
|
|
1 |
-
# Use
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Set
|
5 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
-
ENV PYTHONUNBUFFERED=1
|
7 |
-
|
8 |
-
# Install system dependencies for OpenCV
|
9 |
-
RUN apt-get update && apt-get install -y \
|
10 |
-
libgl1-mesa-glx \
|
11 |
-
libglib2.0-0 \
|
12 |
-
&& rm -rf /var/lib/apt/lists/*
|
13 |
-
|
14 |
-
# Set the working directory in the container
|
15 |
WORKDIR /app
|
16 |
|
17 |
-
# Copy
|
18 |
-
COPY
|
|
|
|
|
|
|
19 |
|
20 |
-
#
|
21 |
-
RUN
|
22 |
-
|
|
|
23 |
|
24 |
-
#
|
25 |
-
|
|
|
26 |
|
27 |
-
# Expose the port
|
28 |
-
EXPOSE
|
29 |
|
30 |
-
# Run the app
|
31 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
|
|
1 |
+
# Use a Python base image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
+
# Set working directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Copy files
|
8 |
+
COPY . /app
|
9 |
+
|
10 |
+
# Install dependencies
|
11 |
+
RUN pip install --upgrade pip && pip install -r requirements.txt
|
12 |
|
13 |
+
# Create writable cache/config directories
|
14 |
+
RUN mkdir -p /app/cache/matplotlib && \
|
15 |
+
mkdir -p /app/cache/torchxrayvision && \
|
16 |
+
chmod -R 777 /app/cache
|
17 |
|
18 |
+
# Set environment variables for cache directories
|
19 |
+
ENV MPLCONFIGDIR=/app/cache/matplotlib
|
20 |
+
ENV TORCHXRAYVISION_CACHE=/app/cache/torchxrayvision
|
21 |
|
22 |
+
# Expose the port the app runs on
|
23 |
+
EXPOSE 7860
|
24 |
|
25 |
+
# Run the app
|
26 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|