tommy24 commited on
Commit
e7d5f0c
·
verified ·
1 Parent(s): 5714ad7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -25
Dockerfile CHANGED
@@ -37,44 +37,39 @@
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
  pkg-config \
58
- libcairo2-dev \
59
- && rm -rf /var/lib/apt/lists/*
60
  libpango1.0-dev \
 
61
  libpangocairo-1.0-0 \
 
 
 
 
 
 
 
62
 
63
- # Copy the requirements file
64
- COPY requirements.txt /app/
65
 
66
  # Install Python dependencies
67
  RUN pip install --no-cache-dir -r requirements.txt
68
 
69
- # Create necessary directories and set proper permissions
70
- RUN mkdir -p /app/media/images && \
71
- chmod -R 775 /app/media
72
 
73
- # Copy the app code into the container
74
- COPY . /app/
75
 
76
- # Expose the port FastAPI will run on
77
- EXPOSE 7860
 
78
 
79
- # Command to run the FastAPI app with uvicorn
80
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
37
  # # Run the FastAPI server
38
  # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
39
 
40
+ # Use an official Python runtime as a parent image
 
41
  FROM python:3.9-slim
42
 
43
+ # Set the working directory in the container
 
 
 
44
  WORKDIR /app
45
 
46
+ # Install system dependencies required for building the Python packages
47
  RUN apt-get update && apt-get install -y \
 
 
 
 
 
48
  pkg-config \
 
 
49
  libpango1.0-dev \
50
+ libcairo2-dev \
51
  libpangocairo-1.0-0 \
52
+ gcc \
53
+ g++ \
54
+ libglib2.0-dev \
55
+ && rm -rf /var/lib/apt/lists/*
56
+
57
+ # Upgrade pip to the latest version
58
+ RUN pip install --upgrade pip
59
 
60
+ # Copy the current directory contents into the container at /app
61
+ COPY . /app
62
 
63
  # Install Python dependencies
64
  RUN pip install --no-cache-dir -r requirements.txt
65
 
66
+ # Set environment variables (if necessary)
67
+ # ENV SOME_ENV_VAR=value
 
68
 
69
+ # Expose the port your app will run on (adjust based on your app's needs)
70
+ EXPOSE 8000
71
 
72
+ # Define the command to run your application
73
+ # Replace this with the command to run your application, e.g., python app.py
74
+ CMD ["python", "app.py"]
75