Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +39 -0
Dockerfile
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Disable Python buffering for easier container logging
|
5 |
+
ENV PYTHONUNBUFFERED=1
|
6 |
+
|
7 |
+
# Set MPLCONFIGDIR to a writable directory for Matplotlib
|
8 |
+
ENV MPLCONFIGDIR=/tmp/matplotlib
|
9 |
+
|
10 |
+
# Set the working directory in the container
|
11 |
+
WORKDIR /app
|
12 |
+
|
13 |
+
# Install system dependencies (ffmpeg is needed for video processing, and libsm6/libxext6 support image/video)
|
14 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
15 |
+
ffmpeg \
|
16 |
+
libsm6 \
|
17 |
+
libxext6 \
|
18 |
+
&& rm -rf /var/lib/apt/lists/*
|
19 |
+
|
20 |
+
# Copy the requirements.txt file into the container
|
21 |
+
COPY requirements.txt /app/requirements.txt
|
22 |
+
|
23 |
+
# Upgrade pip and install Python dependencies
|
24 |
+
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
25 |
+
|
26 |
+
# Download spaCy's small English model
|
27 |
+
RUN python -m spacy download en_core_web_sm
|
28 |
+
|
29 |
+
# Create required directories with proper permissions
|
30 |
+
RUN mkdir -p /app/static /app/temp && chmod -R 777 /app/static /app/temp
|
31 |
+
|
32 |
+
# Copy the rest of your application code into the container
|
33 |
+
COPY . /app
|
34 |
+
|
35 |
+
# Expose the port your app runs on
|
36 |
+
EXPOSE 8500
|
37 |
+
|
38 |
+
# Run the FastAPI application using uvicorn
|
39 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8500"]
|