Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +35 -28
Dockerfile
CHANGED
@@ -1,28 +1,35 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
# Set
|
8 |
-
|
9 |
-
|
10 |
-
ENV
|
11 |
-
ENV
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
#
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
#
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Set environment variables for HF cache
|
8 |
+
ENV HF_HOME=/data/hf_cache
|
9 |
+
ENV TRANSFORMERS_CACHE=/data/hf_cache/transformers
|
10 |
+
ENV HF_DATASETS_CACHE=/data/hf_cache/datasets
|
11 |
+
ENV HF_HUB_CACHE=/data/hf_cache/hub
|
12 |
+
|
13 |
+
# Create cache directories and give permissions
|
14 |
+
RUN mkdir -p /data/hf_cache/transformers /data/hf_cache/datasets /data/hf_cache/hub \
|
15 |
+
&& chmod -R 777 /data/hf_cache
|
16 |
+
|
17 |
+
# Create .streamlit directory for Streamlit configs
|
18 |
+
RUN mkdir -p /app/.streamlit
|
19 |
+
|
20 |
+
# Copy requirements and install dependencies
|
21 |
+
COPY requirements.txt .
|
22 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
23 |
+
|
24 |
+
# Copy the rest of your app code
|
25 |
+
COPY . .
|
26 |
+
|
27 |
+
# If you have a .streamlit/config.toml, copy it explicitly
|
28 |
+
# This prevents the PermissionError when Streamlit tries to write defaults
|
29 |
+
COPY .streamlit/config.toml /app/.streamlit/
|
30 |
+
|
31 |
+
# Expose the port Streamlit runs on
|
32 |
+
EXPOSE 8501
|
33 |
+
|
34 |
+
# Run Streamlit
|
35 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|