Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -7
Dockerfile
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
# Install system dependencies
|
|
@@ -11,19 +10,28 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
git \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Copy project files
|
| 15 |
-
COPY requirements.txt ./
|
| 16 |
-
COPY src/ ./src/
|
| 17 |
-
COPY config.toml /root/.streamlit/config.toml # config.toml at ~/.streamlit
|
| 18 |
|
| 19 |
# Install Python dependencies
|
| 20 |
RUN pip3 install -r requirements.txt
|
| 21 |
|
| 22 |
-
# Expose Streamlit
|
| 23 |
EXPOSE 8501
|
| 24 |
|
| 25 |
-
# Healthcheck
|
| 26 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 27 |
|
| 28 |
-
#
|
| 29 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py"]
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# Install system dependencies
|
|
|
|
| 10 |
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# Create Streamlit config file directly in container
|
| 14 |
+
RUN mkdir -p /root/.streamlit && \
|
| 15 |
+
echo "\
|
| 16 |
+
[server]\n\
|
| 17 |
+
enableXsrfProtection = false\n\
|
| 18 |
+
port = 8501\n\
|
| 19 |
+
address = \"0.0.0.0\"\n\
|
| 20 |
+
headless = true\n\
|
| 21 |
+
" > /root/.streamlit/config.toml
|
| 22 |
+
|
| 23 |
# Copy project files
|
| 24 |
+
COPY requirements.txt ./
|
| 25 |
+
COPY src/ ./src/
|
|
|
|
| 26 |
|
| 27 |
# Install Python dependencies
|
| 28 |
RUN pip3 install -r requirements.txt
|
| 29 |
|
| 30 |
+
# Expose Streamlit port
|
| 31 |
EXPOSE 8501
|
| 32 |
|
| 33 |
+
# Healthcheck for Hugging Face
|
| 34 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 35 |
|
| 36 |
+
# Start the Streamlit app
|
| 37 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py"]
|