Spaces:
Runtime error
Runtime error
Really-amin
commited on
Commit
•
9a98b33
1
Parent(s):
0f347e7
Upload Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
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 \
|
12 |
+
build-essential \
|
13 |
+
curl \
|
14 |
+
git \
|
15 |
+
&& rm -rf /var/lib/apt/lists/*
|
16 |
+
|
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 |
+
|
35 |
+
CMD ["python", "app.py"]
|