Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +22 -20
Dockerfile
CHANGED
@@ -1,35 +1,37 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.
|
3 |
|
4 |
-
# Set working directory
|
5 |
-
WORKDIR /
|
6 |
|
7 |
-
# Install system dependencies
|
|
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
-
|
|
|
|
|
|
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
# Copy requirements
|
|
|
13 |
COPY requirements.txt .
|
14 |
-
RUN pip install --no-cache-dir --upgrade pip && \
|
15 |
-
pip install --no-cache-dir "numpy<2.0.0" && \
|
16 |
-
pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
-
USER user
|
24 |
|
25 |
-
# Expose the port that Streamlit
|
26 |
EXPOSE 7860
|
27 |
|
28 |
-
# Set environment variables for Streamlit
|
29 |
-
ENV STREAMLIT_SERVER_PORT=7860
|
30 |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
|
|
31 |
ENV STREAMLIT_SERVER_HEADLESS=true
|
32 |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
33 |
|
34 |
-
#
|
35 |
-
|
|
|
|
1 |
+
# Use Python 3.9 slim image as base, which is a good choice for stability and size.
|
2 |
+
FROM python:3.9-slim
|
3 |
|
4 |
+
# Set the working directory inside the container
|
5 |
+
WORKDIR /app
|
6 |
|
7 |
+
# Install system dependencies required for RDKit and other graphical libraries.
|
8 |
+
# This is a crucial step for rdkit-pypi to work correctly in a Linux container.
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
+
gcc \
|
11 |
+
g++ \
|
12 |
+
libxext6 \
|
13 |
+
libxrender1 \
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
+
# Copy the requirements file first to leverage Docker's layer caching.
|
17 |
+
# The Docker build will only re-run the pip install step if this file changes.
|
18 |
COPY requirements.txt .
|
|
|
|
|
|
|
19 |
|
20 |
+
# Install the Python dependencies specified in requirements.txt
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy the rest of your application code into the container
|
24 |
+
COPY . .
|
|
|
25 |
|
26 |
+
# Expose the port that Streamlit will run on. Hugging Face Spaces typically uses 7860.
|
27 |
EXPOSE 7860
|
28 |
|
29 |
+
# Set environment variables for Streamlit to run in a headless environment.
|
|
|
30 |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
31 |
+
ENV STREAMLIT_SERVER_PORT=7860
|
32 |
ENV STREAMLIT_SERVER_HEADLESS=true
|
33 |
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
34 |
|
35 |
+
# The command to run your Streamlit application when the container starts.
|
36 |
+
# It points to the app.py file and sets the server address and port.
|
37 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|