Spaces:
Sleeping
Sleeping
WebashalarForML
commited on
Commit
•
cf3b972
1
Parent(s):
e634f6b
Update Dockerfile
Browse files- Dockerfile +7 -12
Dockerfile
CHANGED
@@ -5,19 +5,14 @@ FROM python:3.9-slim
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
ENV PYTHONUNBUFFERED 1
|
7 |
|
8 |
-
# Set environment variables
|
9 |
-
#ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
10 |
-
#ENV PATH="/home/user/.local/bin:$PATH"
|
11 |
-
#ENV HF_HOME="/app/.cache/huggingface"
|
12 |
-
|
13 |
# Set environment variables for Hugging Face cache to /tmp (which is writable)
|
14 |
ENV TRANSFORMERS_CACHE=/tmp/huggingface
|
15 |
ENV HF_HOME=/tmp/huggingface
|
16 |
|
17 |
-
# Ensure permissions are correct (optional, but just in case)
|
18 |
RUN mkdir -p /tmp/huggingface && chmod -R 777 /tmp/huggingface
|
19 |
|
20 |
-
# Create cache directories
|
21 |
RUN mkdir -p /app/.cache/huggingface /app/.cache/matplotlib
|
22 |
|
23 |
# Set environment variables for Hugging Face and Matplotlib cache
|
@@ -31,6 +26,9 @@ RUN chmod -R 777 /app/.cache
|
|
31 |
# Give write permissions to the /app directory
|
32 |
RUN chmod -R 777 /app
|
33 |
|
|
|
|
|
|
|
34 |
# Set the working directory
|
35 |
WORKDIR /app
|
36 |
|
@@ -41,7 +39,7 @@ RUN apt-get update && apt-get install -y \
|
|
41 |
libglib2.0-0 \
|
42 |
&& rm -rf /var/lib/apt/lists/*
|
43 |
|
44 |
-
# Set environment variables for
|
45 |
ENV MPLCONFIGDIR=/tmp/matplotlib
|
46 |
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
47 |
|
@@ -51,9 +49,6 @@ COPY requirements.txt /app/
|
|
51 |
# Install any needed packages specified in requirements.txt
|
52 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
53 |
|
54 |
-
# Create directories for session storage and uploads
|
55 |
-
#RUN mkdir -p /app/flask_sessions /app/uploads && chmod -R 777 /app/flask_sessions /app/uploads
|
56 |
-
|
57 |
# Create directories for session storage, uploads, and cache
|
58 |
RUN mkdir -p /app/flask_sessions /app/uploads /tmp/matplotlib /tmp/transformers_cache && chmod -R 777 /app/flask_sessions /app/uploads /tmp/matplotlib /tmp/transformers_cache
|
59 |
|
@@ -68,4 +63,4 @@ ENV FLASK_APP=app.py
|
|
68 |
ENV FLASK_ENV=production
|
69 |
|
70 |
# Command to run the Flask app using Gunicorn
|
71 |
-
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]
|
|
|
5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
ENV PYTHONUNBUFFERED 1
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
# Set environment variables for Hugging Face cache to /tmp (which is writable)
|
9 |
ENV TRANSFORMERS_CACHE=/tmp/huggingface
|
10 |
ENV HF_HOME=/tmp/huggingface
|
11 |
|
12 |
+
# Ensure permissions are correct for /tmp/huggingface (optional, but just in case)
|
13 |
RUN mkdir -p /tmp/huggingface && chmod -R 777 /tmp/huggingface
|
14 |
|
15 |
+
# Create cache directories for Hugging Face and Matplotlib
|
16 |
RUN mkdir -p /app/.cache/huggingface /app/.cache/matplotlib
|
17 |
|
18 |
# Set environment variables for Hugging Face and Matplotlib cache
|
|
|
26 |
# Give write permissions to the /app directory
|
27 |
RUN chmod -R 777 /app
|
28 |
|
29 |
+
# Create /app/logs directory and set permissions for logging
|
30 |
+
RUN mkdir -p /app/logs && chmod -R 777 /app/logs
|
31 |
+
|
32 |
# Set the working directory
|
33 |
WORKDIR /app
|
34 |
|
|
|
39 |
libglib2.0-0 \
|
40 |
&& rm -rf /var/lib/apt/lists/*
|
41 |
|
42 |
+
# Set environment variables for Matplotlib and Hugging Face cache directories
|
43 |
ENV MPLCONFIGDIR=/tmp/matplotlib
|
44 |
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
45 |
|
|
|
49 |
# Install any needed packages specified in requirements.txt
|
50 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
51 |
|
|
|
|
|
|
|
52 |
# Create directories for session storage, uploads, and cache
|
53 |
RUN mkdir -p /app/flask_sessions /app/uploads /tmp/matplotlib /tmp/transformers_cache && chmod -R 777 /app/flask_sessions /app/uploads /tmp/matplotlib /tmp/transformers_cache
|
54 |
|
|
|
63 |
ENV FLASK_ENV=production
|
64 |
|
65 |
# Command to run the Flask app using Gunicorn
|
66 |
+
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]
|