Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +22 -12
Dockerfile
CHANGED
|
@@ -1,20 +1,30 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
COPY . /app
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
apt-get clean && \
|
| 10 |
-
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
RUN mkdir -p /app/cache
|
| 18 |
|
| 19 |
-
|
| 20 |
-
CMD ["
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.8-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
libglib2.0-0 \
|
| 10 |
+
libsm6 \
|
| 11 |
+
libxrender1 \
|
| 12 |
+
libxext6
|
| 13 |
+
|
| 14 |
+
# Set environment variable for transformers cache
|
| 15 |
+
ENV TRANSFORMERS_CACHE=/app/cache
|
| 16 |
+
|
| 17 |
+
# Copy the current directory contents into the container at /app
|
| 18 |
COPY . /app
|
| 19 |
|
| 20 |
+
# Install any needed packages specified in requirements.txt
|
| 21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
# Expose port 8000 for the FastAPI app
|
| 24 |
+
EXPOSE 8000
|
| 25 |
|
| 26 |
+
# Create cache directory
|
| 27 |
+
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
|
|
|
| 28 |
|
| 29 |
+
# Run the FastAPI app with uvicorn
|
| 30 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|