Update Dockerfile
Browse files- Dockerfile +28 -3
Dockerfile
CHANGED
@@ -1,6 +1,31 @@
|
|
|
|
1 |
FROM python:3.10-slim
|
|
|
|
|
2 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
COPY . .
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.10-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the requirements file into the container at /app
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# Install any needed packages specified in requirements.txt
|
11 |
+
# Use --no-cache-dir to reduce layer size and --compile to precompile .py to .pyc
|
12 |
+
RUN pip install --no-cache-dir --compile -r requirements.txt
|
13 |
+
|
14 |
+
# Copy the rest of the application code into the container at /app
|
15 |
COPY . .
|
16 |
+
|
17 |
+
# Make port 8501 available to the world outside this container (Streamlit default)
|
18 |
+
EXPOSE 8501
|
19 |
+
|
20 |
+
# Define environment variable for Streamlit
|
21 |
+
ENV STREAMLIT_SERVER_PORT 8501
|
22 |
+
ENV STREAMLIT_SERVER_HEADLESS true
|
23 |
+
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS false
|
24 |
+
|
25 |
+
# Healthcheck (optional but good for orchestration)
|
26 |
+
# HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
27 |
+
|
28 |
+
# Run app.py when the container launches
|
29 |
+
# Use `streamlit run app.py` which is the standard way to run Streamlit apps
|
30 |
+
# Add --server.address=0.0.0.0 to make it accessible from outside the container
|
31 |
+
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0"]
|