Spaces:
Sleeping
Sleeping
sakshamlakhera
commited on
Commit
·
cd681a1
1
Parent(s):
85a1f1d
docker fix cache
Browse files- Dockerfile +14 -4
Dockerfile
CHANGED
@@ -9,15 +9,25 @@ RUN apt-get update && apt-get install -y \
|
|
9 |
git \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
COPY . .
|
14 |
|
15 |
-
# Install dependencies
|
16 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
17 |
|
|
|
18 |
EXPOSE 8501
|
19 |
|
|
|
20 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
21 |
-
|
22 |
-
# Run
|
23 |
ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
9 |
git \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
+
# Set safe environment paths for Streamlit and Torch
|
13 |
+
ENV STREAMLIT_HOME="/app/.streamlit"
|
14 |
+
ENV TORCH_HOME="/app/.cache/torch"
|
15 |
+
|
16 |
+
# Create writable directories
|
17 |
+
RUN mkdir -p $STREAMLIT_HOME $TORCH_HOME /assets \
|
18 |
+
&& chmod -R 777 $STREAMLIT_HOME $TORCH_HOME /assets
|
19 |
+
|
20 |
+
# Copy app code
|
21 |
COPY . .
|
22 |
|
23 |
+
# Install Python dependencies
|
24 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
25 |
|
26 |
+
# Expose Streamlit port
|
27 |
EXPOSE 8501
|
28 |
|
29 |
+
# Add health check for Docker
|
30 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
31 |
+
|
32 |
+
# Run Streamlit
|
33 |
ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.address=0.0.0.0"]
|