Update Dockerfile
Browse files- Dockerfile +14 -18
Dockerfile
CHANGED
@@ -1,35 +1,31 @@
|
|
1 |
-
# Use an official Python
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
-
# Set environment variables to prevent Python from writing .pyc files and
|
5 |
-
ENV
|
6 |
-
|
7 |
|
8 |
-
# Set the working directory
|
9 |
WORKDIR /app
|
10 |
|
11 |
# Install system dependencies
|
12 |
-
RUN apt-get update && apt-get install -y \
|
13 |
build-essential \
|
14 |
curl \
|
15 |
-
git \
|
16 |
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
-
# Copy the requirements file
|
19 |
COPY requirements.txt .
|
|
|
20 |
|
21 |
-
#
|
22 |
-
RUN pip install --upgrade pip && \
|
23 |
-
pip install --no-cache-dir -r requirements.txt
|
24 |
-
|
25 |
-
# Copy the rest of the application code into the container
|
26 |
COPY . .
|
27 |
|
28 |
-
# Expose the port that Streamlit
|
29 |
EXPOSE 8501
|
30 |
|
31 |
-
#
|
32 |
-
|
33 |
|
34 |
-
#
|
35 |
-
CMD ["app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
1 |
+
# Use an official lightweight Python image
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
+
# Set environment variables to prevent Python from writing .pyc files and buffering stdout/stderr
|
5 |
+
ENV PYTHONUNBUFFERED=1 \
|
6 |
+
PYTHONDONTWRITEBYTECODE=1
|
7 |
|
8 |
+
# Set the working directory inside the container
|
9 |
WORKDIR /app
|
10 |
|
11 |
# Install system dependencies
|
12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
13 |
build-essential \
|
14 |
curl \
|
|
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
+
# Copy the requirements file and install Python dependencies
|
18 |
COPY requirements.txt .
|
19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
20 |
|
21 |
+
# Copy the rest of the application code
|
|
|
|
|
|
|
|
|
22 |
COPY . .
|
23 |
|
24 |
+
# Expose the port that Streamlit listens on
|
25 |
EXPOSE 8501
|
26 |
|
27 |
+
# Healthcheck to ensure the app is running
|
28 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
29 |
|
30 |
+
# Run the Streamlit app
|
31 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|