Update Dockerfile
Browse files- Dockerfile +63 -25
Dockerfile
CHANGED
@@ -1,38 +1,76 @@
|
|
1 |
-
# Use an official Python base image
|
2 |
-
FROM python:3.9
|
3 |
|
4 |
-
# Set environment variables
|
5 |
-
ENV PYTHONUNBUFFERED=1 \
|
6 |
-
|
7 |
|
8 |
-
RUN pip install importlib-metadata
|
9 |
|
10 |
-
# Install required system libraries for Manim and dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
12 |
ffmpeg \
|
13 |
-
|
14 |
-
|
15 |
-
libx11-6 \
|
16 |
-
libgl1-mesa-glx \
|
17 |
-
xvfb \
|
18 |
-
pkg-config \
|
19 |
-
libpango1.0-dev \
|
20 |
-
libcairo2-dev \
|
21 |
-
&& apt-get clean
|
22 |
-
|
23 |
-
# Set the working directory
|
24 |
-
WORKDIR /app
|
25 |
|
26 |
-
# Copy
|
27 |
-
COPY . /app
|
28 |
|
29 |
# Install Python dependencies
|
30 |
-
RUN pip install --no-cache-dir --upgrade pip
|
31 |
-
COPY requirements.txt .
|
32 |
RUN pip install --no-cache-dir -r requirements.txt
|
33 |
|
34 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
EXPOSE 7860
|
36 |
|
37 |
-
#
|
38 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# # Use an official Python base image
|
2 |
+
# FROM python:3.9
|
3 |
|
4 |
+
# # Set environment variables
|
5 |
+
# ENV PYTHONUNBUFFERED=1 \
|
6 |
+
# PYTHONDONTWRITEBYTECODE=1
|
7 |
|
8 |
+
# RUN pip install importlib-metadata
|
9 |
|
10 |
+
# # Install required system libraries for Manim and dependencies
|
11 |
+
# RUN apt-get update && apt-get install -y \
|
12 |
+
# ffmpeg \
|
13 |
+
# libcairo2 \
|
14 |
+
# libpango1.0-0 \
|
15 |
+
# libx11-6 \
|
16 |
+
# libgl1-mesa-glx \
|
17 |
+
# xvfb \
|
18 |
+
# pkg-config \
|
19 |
+
# libpango1.0-dev \
|
20 |
+
# libcairo2-dev \
|
21 |
+
# && apt-get clean
|
22 |
+
|
23 |
+
# # Set the working directory
|
24 |
+
# WORKDIR /app
|
25 |
+
|
26 |
+
# # Copy project files
|
27 |
+
# COPY . /app
|
28 |
+
|
29 |
+
# # Install Python dependencies
|
30 |
+
# RUN pip install --no-cache-dir --upgrade pip
|
31 |
+
# COPY requirements.txt .
|
32 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
33 |
+
|
34 |
+
# # Expose the port
|
35 |
+
# EXPOSE 7860
|
36 |
+
|
37 |
+
# # Run the FastAPI server
|
38 |
+
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
39 |
+
|
40 |
+
|
41 |
+
# Use the official Python image as a base image
|
42 |
+
FROM python:3.9-slim
|
43 |
+
|
44 |
+
# Set environment variables to avoid buffering in the output
|
45 |
+
ENV PYTHONUNBUFFERED=1
|
46 |
+
|
47 |
+
# Set working directory
|
48 |
+
WORKDIR /app
|
49 |
+
|
50 |
+
# Install system dependencies needed for Manim and FastAPI
|
51 |
RUN apt-get update && apt-get install -y \
|
52 |
+
libfreetype6-dev \
|
53 |
+
libx11-dev \
|
54 |
+
libx264-dev \
|
55 |
ffmpeg \
|
56 |
+
build-essential \
|
57 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
# Copy the requirements file
|
60 |
+
COPY requirements.txt /app/
|
61 |
|
62 |
# Install Python dependencies
|
|
|
|
|
63 |
RUN pip install --no-cache-dir -r requirements.txt
|
64 |
|
65 |
+
# Create necessary directories and set proper permissions
|
66 |
+
RUN mkdir -p /app/media/images && \
|
67 |
+
chmod -R 775 /app/media
|
68 |
+
|
69 |
+
# Copy the app code into the container
|
70 |
+
COPY . /app/
|
71 |
+
|
72 |
+
# Expose the port FastAPI will run on
|
73 |
EXPOSE 7860
|
74 |
|
75 |
+
# Command to run the FastAPI app with uvicorn
|
76 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|