Update Dockerfile
Browse files- Dockerfile +19 -11
Dockerfile
CHANGED
@@ -1,11 +1,18 @@
|
|
1 |
FROM python:3.9-slim
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
-
#
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
8 |
ENV XDG_CACHE_HOME=/app/.streamlit
|
|
|
9 |
|
10 |
# Install system dependencies
|
11 |
RUN apt-get update && apt-get install -y \
|
@@ -16,24 +23,25 @@ RUN apt-get update && apt-get install -y \
|
|
16 |
git \
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
-
#
|
20 |
-
RUN mkdir -p /app/.cache/huggingface/hub /app/.streamlit && \
|
21 |
-
chmod -R 777 /app/.cache /app/.streamlit
|
22 |
-
|
23 |
-
# Copy Python dependencies
|
24 |
COPY requirements.txt ./
|
25 |
-
RUN
|
26 |
|
27 |
-
# Copy
|
28 |
COPY app.py ./
|
29 |
COPY utils/ ./utils/
|
30 |
COPY models/ ./models/
|
31 |
COPY .streamlit/ .streamlit/
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
EXPOSE 8501
|
34 |
|
35 |
-
#
|
36 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
37 |
|
38 |
-
#
|
39 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
3 |
+
# Set working directory
|
4 |
WORKDIR /app
|
5 |
|
6 |
+
# Create needed directories first with full permissions
|
7 |
+
RUN mkdir -p /app/.cache/huggingface/hub \
|
8 |
+
&& mkdir -p /app/.streamlit \
|
9 |
+
&& chmod -R 777 /app/.cache \
|
10 |
+
&& chmod -R 777 /app/.streamlit
|
11 |
+
|
12 |
+
# Set env variables BEFORE installing anything
|
13 |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
14 |
ENV XDG_CACHE_HOME=/app/.streamlit
|
15 |
+
ENV HOME=/app
|
16 |
|
17 |
# Install system dependencies
|
18 |
RUN apt-get update && apt-get install -y \
|
|
|
23 |
git \
|
24 |
&& rm -rf /var/lib/apt/lists/*
|
25 |
|
26 |
+
# Install Python dependencies
|
|
|
|
|
|
|
|
|
27 |
COPY requirements.txt ./
|
28 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
+
# Copy app code
|
31 |
COPY app.py ./
|
32 |
COPY utils/ ./utils/
|
33 |
COPY models/ ./models/
|
34 |
COPY .streamlit/ .streamlit/
|
35 |
|
36 |
+
# Fix permissions again AFTER copying files (important)
|
37 |
+
RUN chmod -R 777 /app/.cache \
|
38 |
+
&& chmod -R 777 /app/.streamlit
|
39 |
+
|
40 |
+
# Expose port
|
41 |
EXPOSE 8501
|
42 |
|
43 |
+
# Healthcheck (optional)
|
44 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
45 |
|
46 |
+
# Start the app
|
47 |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|