Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -5
Dockerfile
CHANGED
|
@@ -2,7 +2,13 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
curl \
|
|
@@ -19,22 +25,22 @@ RUN apt-get update && apt-get install -y \
|
|
| 19 |
zlib1g-dev \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
# Copy project files
|
| 23 |
COPY requirements.txt ./
|
| 24 |
COPY src/ ./src/
|
| 25 |
|
| 26 |
-
# Install
|
| 27 |
RUN pip install --upgrade pip && \
|
| 28 |
pip install "numpy<2.0" && \
|
| 29 |
pip install -r requirements.txt && \
|
| 30 |
pip install torchvision==0.15.2 && \
|
| 31 |
pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
| 32 |
|
| 33 |
-
# Expose Streamlit port
|
| 34 |
EXPOSE 8501
|
| 35 |
|
| 36 |
-
# Health check endpoint
|
| 37 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 38 |
|
| 39 |
-
# Start Streamlit app
|
| 40 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Set HOME to a writable location
|
| 6 |
+
ENV HOME=/app
|
| 7 |
+
ENV MPLCONFIGDIR=/app/.config/matplotlib
|
| 8 |
+
ENV TORCH_HOME=/app/.torch
|
| 9 |
+
ENV STREAMLIT_HOME=/app/.streamlit
|
| 10 |
+
|
| 11 |
+
# Install system dependencies
|
| 12 |
RUN apt-get update && apt-get install -y \
|
| 13 |
build-essential \
|
| 14 |
curl \
|
|
|
|
| 25 |
zlib1g-dev \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
+
# Create required writable folders
|
| 29 |
+
RUN mkdir -p /app/.torch /app/.streamlit /app/.config/matplotlib
|
| 30 |
+
|
| 31 |
# Copy project files
|
| 32 |
COPY requirements.txt ./
|
| 33 |
COPY src/ ./src/
|
| 34 |
|
| 35 |
+
# Install Python dependencies
|
| 36 |
RUN pip install --upgrade pip && \
|
| 37 |
pip install "numpy<2.0" && \
|
| 38 |
pip install -r requirements.txt && \
|
| 39 |
pip install torchvision==0.15.2 && \
|
| 40 |
pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
| 41 |
|
|
|
|
| 42 |
EXPOSE 8501
|
| 43 |
|
|
|
|
| 44 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 45 |
|
|
|
|
| 46 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|