Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +11 -11
Dockerfile
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
# Use
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Copy requirements
|
8 |
COPY requirements.txt .
|
9 |
|
10 |
-
# Install dependencies
|
11 |
-
RUN
|
|
|
|
|
|
|
12 |
|
13 |
# Copy application code
|
14 |
-
COPY . .
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
ENV TRANSFORMERS_CACHE=/app/cache
|
19 |
-
# Set to 1 if using quantization and GPU is available
|
20 |
-
ENV USE_QUANTIZATION=0
|
21 |
|
22 |
# Expose port for FastAPI
|
23 |
EXPOSE 8000
|
24 |
|
25 |
-
# Run
|
26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
1 |
+
# Use official Python 3.10 slim image for a smaller footprint
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Copy requirements file
|
8 |
COPY requirements.txt .
|
9 |
|
10 |
+
# Install system dependencies and Python packages
|
11 |
+
RUN apt-get update && apt-get install -y \
|
12 |
+
gcc \
|
13 |
+
&& rm -rf /var/lib/apt/lists/* \
|
14 |
+
&& pip install --no-cache-dir -r requirements.txt
|
15 |
|
16 |
# Copy application code
|
17 |
+
COPY app.py .
|
18 |
|
19 |
+
# Create cache directory for Hugging Face models
|
20 |
+
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
|
|
|
|
|
|
21 |
|
22 |
# Expose port for FastAPI
|
23 |
EXPOSE 8000
|
24 |
|
25 |
+
# Run Uvicorn server
|
26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|