Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +20 -3
Dockerfile
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
curl \
|
| 8 |
-
software-properties-common \
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
| 12 |
COPY requirements.txt ./
|
| 13 |
-
COPY src/ ./src/
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
EXPOSE 8501
|
| 18 |
|
|
|
|
| 19 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 20 |
|
|
|
|
|
|
|
| 21 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
+
# Base image: Python 3.9 slim version
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
# build-essential is needed for some Python packages that compile C code
|
| 9 |
+
# git might be needed if your requirements.txt installs packages from git repos
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
build-essential \
|
| 12 |
curl \
|
|
|
|
| 13 |
git \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# Copy the requirements file into the container
|
| 17 |
COPY requirements.txt ./
|
|
|
|
| 18 |
|
| 19 |
+
# Install Python dependencies
|
| 20 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
+
# Copy your application code into the container
|
| 23 |
+
# If your app is just app.py and maybe a 'css' folder:
|
| 24 |
+
COPY app.py ./
|
| 25 |
+
COPY css/ ./css/
|
| 26 |
+
# If your app code is in a 'src' directory:
|
| 27 |
+
# COPY src/ ./src/
|
| 28 |
+
# Ensure your app.py is then correctly referenced by the ENTRYPOINT, e.g., "src/app.py"
|
| 29 |
+
|
| 30 |
+
# Expose the port your app runs on (Streamlit default is 8501)
|
| 31 |
EXPOSE 8501
|
| 32 |
|
| 33 |
+
# Healthcheck for Streamlit (optional but good practice)
|
| 34 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 35 |
|
| 36 |
+
# Command to run your application
|
| 37 |
+
# This will run: streamlit run app.py --server.port=8501 --server.address=0.0.0.0
|
| 38 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|