Spaces:
Runtime error
Runtime error
Really-amin
commited on
Commit
•
32ac964
1
Parent(s):
7653389
Upload Dockerfile
Browse files- Dockerfile +10 -13
Dockerfile
CHANGED
@@ -2,7 +2,10 @@ FROM python:3.10-slim
|
|
2 |
|
3 |
ENV PYTHONUNBUFFERED=1 \
|
4 |
PYTHONDONTWRITEBYTECODE=1 \
|
5 |
-
PORT=7860
|
|
|
|
|
|
|
6 |
|
7 |
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
@@ -14,24 +17,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
14 |
WORKDIR /app
|
15 |
|
16 |
# Create required directories
|
17 |
-
RUN mkdir -p /
|
18 |
-
chmod -R 777 /
|
19 |
|
20 |
-
#
|
21 |
COPY requirements.txt .
|
22 |
-
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
23 |
-
pip install --no-cache-dir -r requirements.txt
|
24 |
-
|
25 |
-
# Copy application files
|
26 |
COPY app.py .
|
27 |
COPY static/ static/
|
28 |
COPY templates/ templates/
|
29 |
|
30 |
-
#
|
31 |
-
RUN
|
32 |
-
|
33 |
-
# Set Python path
|
34 |
-
ENV PYTHONPATH=/app
|
35 |
|
36 |
EXPOSE 7860
|
37 |
|
|
|
2 |
|
3 |
ENV PYTHONUNBUFFERED=1 \
|
4 |
PYTHONDONTWRITEBYTECODE=1 \
|
5 |
+
PORT=7860 \
|
6 |
+
HF_HOME=/tmp/cache \
|
7 |
+
TRANSFORMERS_CACHE=/tmp/cache \
|
8 |
+
TORCH_HOME=/tmp/cache/torch
|
9 |
|
10 |
# Install system dependencies
|
11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
17 |
WORKDIR /app
|
18 |
|
19 |
# Create required directories
|
20 |
+
RUN mkdir -p /tmp/cache /tmp/logs && \
|
21 |
+
chmod -R 777 /tmp/cache /tmp/logs
|
22 |
|
23 |
+
# Copy only necessary files
|
24 |
COPY requirements.txt .
|
|
|
|
|
|
|
|
|
25 |
COPY app.py .
|
26 |
COPY static/ static/
|
27 |
COPY templates/ templates/
|
28 |
|
29 |
+
# Install Python dependencies
|
30 |
+
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
31 |
+
pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
32 |
|
33 |
EXPOSE 7860
|
34 |
|