Spaces:
No application file
No application file
Upload dockerfile
Browse files- dockerfile +34 -0
dockerfile
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9-slim
|
2 |
+
|
3 |
+
# Install required packages and git clone as root
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
build-essential \
|
6 |
+
curl \
|
7 |
+
software-properties-common \
|
8 |
+
git \
|
9 |
+
&& rm -rf /var/lib/apt/lists/* \
|
10 |
+
&& git clone https://github.com/streamlit/streamlit-example.git /app
|
11 |
+
|
12 |
+
# Add user and set environment variables
|
13 |
+
RUN useradd -m -u 1000 user
|
14 |
+
USER user
|
15 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
16 |
+
|
17 |
+
# Set the working directory
|
18 |
+
WORKDIR /app
|
19 |
+
|
20 |
+
# Copy requirements.txt and install Python packages
|
21 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
22 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
23 |
+
|
24 |
+
# Copy the rest of the application code
|
25 |
+
COPY --chown=user . /app
|
26 |
+
|
27 |
+
# Expose the port that Streamlit will run on
|
28 |
+
EXPOSE 8501
|
29 |
+
|
30 |
+
# Define a health check
|
31 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
32 |
+
|
33 |
+
# Define the entrypoint command to run the Streamlit app
|
34 |
+
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|