Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +3 -29
Dockerfile
CHANGED
@@ -1,39 +1,13 @@
|
|
1 |
FROM python:3.11-slim
|
2 |
-
|
3 |
-
|
4 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
5 |
-
curl \
|
6 |
-
&& rm -rf /var/lib/apt/lists/*
|
7 |
-
|
8 |
-
# Create non-root user and set up directories with correct permissions
|
9 |
-
RUN useradd -m -u 1000 user \
|
10 |
-
&& mkdir -p /home/user/.local /home/user/app \
|
11 |
-
&& chown -R user:user /home/user
|
12 |
-
|
13 |
USER user
|
14 |
-
ENV HOME=/home/user
|
15 |
-
PATH=/home/user/.local/bin:$PATH
|
16 |
-
|
17 |
-
# Set working directory
|
18 |
WORKDIR /home/user/app
|
19 |
-
|
20 |
-
# Copy requirements first to leverage Docker cache
|
21 |
COPY --chown=user requirements.txt .
|
22 |
-
|
23 |
-
# Install dependencies
|
24 |
RUN pip install --no-cache-dir -r requirements.txt
|
25 |
-
|
26 |
-
# Copy app files
|
27 |
COPY --chown=user app.py presidio_helpers.py .
|
28 |
-
|
29 |
-
# Ensure working directory is writable
|
30 |
RUN chmod -R u+rw /home/user/app
|
31 |
-
|
32 |
-
# Expose Streamlit port
|
33 |
EXPOSE 7860
|
34 |
-
|
35 |
-
# Healthcheck
|
36 |
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
|
37 |
-
|
38 |
-
# Run Streamlit
|
39 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
1 |
FROM python:3.11-slim
|
2 |
+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
3 |
+
RUN useradd -m -u 1000 user && mkdir -p /home/user/.local /home/user/app && chown -R user:user /home/user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
USER user
|
5 |
+
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
|
|
6 |
WORKDIR /home/user/app
|
|
|
|
|
7 |
COPY --chown=user requirements.txt .
|
|
|
|
|
8 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
9 |
COPY --chown=user app.py presidio_helpers.py .
|
|
|
|
|
10 |
RUN chmod -R u+rw /home/user/app
|
|
|
|
|
11 |
EXPOSE 7860
|
|
|
|
|
12 |
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
|
|
|
|
|
13 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|