Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +10 -5
Dockerfile
CHANGED
@@ -1,30 +1,35 @@
|
|
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 |
-
RUN
|
16 |
|
17 |
-
# Add the Streamlit config here
|
18 |
ENV HOME=/app
|
|
|
|
|
19 |
RUN mkdir -p /app/.streamlit && \
|
20 |
echo "[server]\n\
|
21 |
enableCORS = false\n\
|
22 |
enableXsrfProtection = false\n\
|
23 |
-
" > /app/.streamlit/config.toml
|
|
|
24 |
|
|
|
25 |
|
26 |
EXPOSE 8501
|
27 |
|
28 |
-
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
29 |
|
30 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
+
RUN groupadd --gid 1000 appuser && \
|
4 |
+
useradd --uid 1000 --gid 1000 -ms /bin/bash appuser
|
5 |
+
|
6 |
WORKDIR /app
|
7 |
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
build-essential \
|
10 |
curl \
|
|
|
11 |
git \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
COPY requirements.txt ./
|
15 |
COPY src/ ./src/
|
16 |
|
17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
|
|
|
19 |
ENV HOME=/app
|
20 |
+
|
21 |
+
# Create .streamlit config and set permissions
|
22 |
RUN mkdir -p /app/.streamlit && \
|
23 |
echo "[server]\n\
|
24 |
enableCORS = false\n\
|
25 |
enableXsrfProtection = false\n\
|
26 |
+
" > /app/.streamlit/config.toml && \
|
27 |
+
chown -R appuser:appuser /app /app/.streamlit
|
28 |
|
29 |
+
USER appuser
|
30 |
|
31 |
EXPOSE 8501
|
32 |
|
33 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
34 |
|
35 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|