Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +10 -21
Dockerfile
CHANGED
|
@@ -2,12 +2,11 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Set
|
| 6 |
ENV HOME=/app
|
| 7 |
-
ENV MPLCONFIGDIR=/
|
| 8 |
-
ENV TORCH_HOME=/
|
| 9 |
-
ENV STREAMLIT_HOME=/
|
| 10 |
-
ENV PYTHONPATH=$PYTHONPATH:/app
|
| 11 |
|
| 12 |
# Install system dependencies
|
| 13 |
RUN apt-get update && apt-get install -y \
|
|
@@ -34,6 +33,11 @@ RUN mkdir -p /tmp/.torch /tmp/.streamlit /tmp/.matplotlib \
|
|
| 34 |
COPY requirements.txt ./
|
| 35 |
COPY src/ ./src/
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
# Install Python dependencies
|
| 38 |
RUN pip install --upgrade pip && \
|
| 39 |
pip install "numpy<2.0" && \
|
|
@@ -41,23 +45,8 @@ RUN pip install --upgrade pip && \
|
|
| 41 |
pip install torchvision==0.15.2 && \
|
| 42 |
pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
| 43 |
|
| 44 |
-
# Set proper ownership for application files
|
| 45 |
-
RUN chown -R 1000:1000 /app
|
| 46 |
-
|
| 47 |
-
# Expose Streamlit port
|
| 48 |
EXPOSE 8501
|
| 49 |
|
| 50 |
-
# Add a healthcheck
|
| 51 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 52 |
|
| 53 |
-
|
| 54 |
-
USER 1000
|
| 55 |
-
|
| 56 |
-
# Set up Streamlit configuration
|
| 57 |
-
RUN mkdir -p /tmp/.streamlit && echo '\
|
| 58 |
-
[general]\n\
|
| 59 |
-
email = ""\n\
|
| 60 |
-
' > /tmp/.streamlit/credentials.toml
|
| 61 |
-
|
| 62 |
-
# Command to run the app
|
| 63 |
-
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 \
|
|
|
|
| 33 |
COPY requirements.txt ./
|
| 34 |
COPY src/ ./src/
|
| 35 |
|
| 36 |
+
|
| 37 |
+
# Copy project files
|
| 38 |
+
COPY requirements.txt ./
|
| 39 |
+
COPY src/ ./src/
|
| 40 |
+
|
| 41 |
# Install Python dependencies
|
| 42 |
RUN pip install --upgrade pip && \
|
| 43 |
pip install "numpy<2.0" && \
|
|
|
|
| 45 |
pip install torchvision==0.15.2 && \
|
| 46 |
pip install 'git+https://github.com/facebookresearch/detectron2.git'
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
EXPOSE 8501
|
| 49 |
|
|
|
|
| 50 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 51 |
|
| 52 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|