Spaces:
Runtime error
Runtime error
iamspruce
commited on
Commit
·
d6dad7d
1
Parent(s):
f02b7c3
updated dockerfile
Browse files- Dockerfile +8 -20
Dockerfile
CHANGED
|
@@ -1,33 +1,21 @@
|
|
| 1 |
-
# Use an official lightweight Python base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set environment variables
|
| 5 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
-
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
ENV TRANSFORMERS_CACHE=/data
|
| 8 |
-
|
| 9 |
# Set working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
# Install system dependencies
|
| 13 |
-
RUN apt-get update && apt-get install -y
|
| 14 |
-
git \
|
| 15 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
-
|
| 17 |
-
# Copy requirements (you must have a requirements.txt)
|
| 18 |
-
COPY requirements.txt .
|
| 19 |
|
| 20 |
# Install Python dependencies
|
|
|
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
# Create /data dir for model caching
|
| 27 |
-
RUN mkdir -p /data
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
|
| 31 |
|
| 32 |
-
# Run FastAPI
|
| 33 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
# Install system dependencies
|
| 7 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Install Python dependencies
|
| 10 |
+
COPY requirements.txt .
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
+
# Setup Hugging Face cache
|
| 14 |
+
ENV HF_HOME=/cache
|
| 15 |
+
RUN mkdir -p /cache && chmod -R 777 /cache
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Copy app code
|
| 18 |
+
COPY app ./app
|
| 19 |
|
| 20 |
+
# Run the FastAPI app
|
| 21 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|