Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +55 -27
Dockerfile
CHANGED
|
@@ -1,42 +1,70 @@
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
curl \
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
# Create .streamlit directory so Streamlit can store config
|
| 16 |
-
RUN mkdir -p /app/.streamlit
|
| 17 |
-
|
| 18 |
-
# Optional: Disable telemetry collection if desired
|
| 19 |
-
RUN echo "\
|
| 20 |
-
[general]\n\
|
| 21 |
-
email = \"\"\n\
|
| 22 |
-
\n\
|
| 23 |
-
[server]\n\
|
| 24 |
-
headless = true\n\
|
| 25 |
-
enableCORS = false\n\
|
| 26 |
-
\n\
|
| 27 |
-
[browser]\n\
|
| 28 |
-
gatherUsageStats = false\n\
|
| 29 |
-
" > /app/.streamlit/config.toml
|
| 30 |
-
|
| 31 |
-
# Copy files
|
| 32 |
-
COPY requirements.txt ./
|
| 33 |
-
COPY src/ ./src/
|
| 34 |
|
| 35 |
# Install Python dependencies
|
| 36 |
-
RUN
|
| 37 |
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.9 slim image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
| 11 |
git \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Copy requirements
|
| 15 |
+
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Install Python dependencies
|
| 18 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# Copy the application files
|
| 21 |
+
COPY . .
|
| 22 |
|
| 23 |
+
# Expose port for Streamlit
|
| 24 |
+
EXPOSE 7860
|
| 25 |
|
| 26 |
+
# Run Streamlit
|
| 27 |
+
CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
| 28 |
+
# ##################################################################################################
|
| 29 |
+
# FROM python:3.9-slim
|
| 30 |
+
|
| 31 |
+
# WORKDIR /app
|
| 32 |
+
|
| 33 |
+
# # Install required packages
|
| 34 |
+
# RUN apt-get update && apt-get install -y \
|
| 35 |
+
# build-essential \
|
| 36 |
+
# curl \
|
| 37 |
+
# git \
|
| 38 |
+
# && rm -rf /var/lib/apt/lists/*
|
| 39 |
+
|
| 40 |
+
# # Set HOME so Streamlit doesn't try to write to /
|
| 41 |
+
# ENV HOME=/app
|
| 42 |
+
|
| 43 |
+
# # Create .streamlit directory so Streamlit can store config
|
| 44 |
+
# RUN mkdir -p /app/.streamlit
|
| 45 |
+
|
| 46 |
+
# # Optional: Disable telemetry collection if desired
|
| 47 |
+
# RUN echo "\
|
| 48 |
+
# [general]\n\
|
| 49 |
+
# email = \"\"\n\
|
| 50 |
+
# \n\
|
| 51 |
+
# [server]\n\
|
| 52 |
+
# headless = true\n\
|
| 53 |
+
# enableCORS = false\n\
|
| 54 |
+
# \n\
|
| 55 |
+
# [browser]\n\
|
| 56 |
+
# gatherUsageStats = false\n\
|
| 57 |
+
# " > /app/.streamlit/config.toml
|
| 58 |
+
|
| 59 |
+
# # Copy files
|
| 60 |
+
# COPY requirements.txt ./
|
| 61 |
+
# COPY src/ ./src/
|
| 62 |
+
|
| 63 |
+
# # Install Python dependencies
|
| 64 |
+
# RUN pip3 install --no-cache-dir -r requirements.txt
|
| 65 |
+
|
| 66 |
+
# EXPOSE 8501
|
| 67 |
+
|
| 68 |
+
# HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 69 |
+
|
| 70 |
+
# ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|