Update Dockerfile
Browse files- Dockerfile +4 -11
Dockerfile
CHANGED
@@ -4,8 +4,6 @@ FROM python:3.10-slim
|
|
4 |
# Install system dependencies
|
5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
6 |
build-essential \
|
7 |
-
libpq-dev \
|
8 |
-
gcc \
|
9 |
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
# Set the working directory in the container
|
@@ -14,23 +12,18 @@ WORKDIR /app
|
|
14 |
# Copy only the requirements file to leverage Docker cache
|
15 |
COPY requirements.txt /app/
|
16 |
|
17 |
-
# Install
|
18 |
RUN pip install --no-cache-dir --upgrade pip
|
19 |
-
|
20 |
-
# Install gunicorn separately to capture any errors
|
21 |
-
RUN pip install --no-cache-dir gunicorn
|
22 |
-
|
23 |
-
# Install the rest of the requirements
|
24 |
RUN pip install --no-cache-dir -r requirements.txt
|
25 |
|
26 |
-
# Verify gunicorn installation
|
27 |
-
RUN which gunicorn
|
28 |
-
|
29 |
# Copy the current directory contents into the container
|
30 |
COPY . /app
|
31 |
|
32 |
# Expose the port that the FastAPI app runs on
|
33 |
EXPOSE 8001
|
34 |
|
|
|
|
|
|
|
35 |
# Command to run the app with Gunicorn and Uvicorn workers
|
36 |
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--workers", "4", "--bind", "0.0.0.0:8001", "main:app"]
|
|
|
4 |
# Install system dependencies
|
5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
6 |
build-essential \
|
|
|
|
|
7 |
&& rm -rf /var/lib/apt/lists/*
|
8 |
|
9 |
# Set the working directory in the container
|
|
|
12 |
# Copy only the requirements file to leverage Docker cache
|
13 |
COPY requirements.txt /app/
|
14 |
|
15 |
+
# Install Python dependencies
|
16 |
RUN pip install --no-cache-dir --upgrade pip
|
|
|
|
|
|
|
|
|
|
|
17 |
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
|
|
|
|
|
|
|
19 |
# Copy the current directory contents into the container
|
20 |
COPY . /app
|
21 |
|
22 |
# Expose the port that the FastAPI app runs on
|
23 |
EXPOSE 8001
|
24 |
|
25 |
+
# Environment variables (set your actual APP_SECRET securely)
|
26 |
+
ENV APP_SECRET=your_app_secret_here
|
27 |
+
|
28 |
# Command to run the app with Gunicorn and Uvicorn workers
|
29 |
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--workers", "4", "--bind", "0.0.0.0:8001", "main:app"]
|