Update Dockerfile
Browse files- Dockerfile +11 -20
Dockerfile
CHANGED
|
@@ -1,30 +1,21 @@
|
|
| 1 |
-
# Use the official
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
-
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
|
| 8 |
-
# Set work directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
|
| 13 |
-
|
| 14 |
-
# Install dependencies
|
| 15 |
COPY requirements.txt .
|
| 16 |
-
RUN pip install --upgrade pip
|
| 17 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
-
# Copy
|
| 20 |
COPY . .
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
ENV PORT=8001
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"
|
|
|
|
| 1 |
+
# Use the official FastAPI image with Python 3.9
|
| 2 |
+
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
|
| 3 |
|
| 4 |
+
# Set the working directory
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy requirements and install dependencies
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY requirements.txt .
|
|
|
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
| 11 |
+
# Copy the application code
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
+
# Set environment variables
|
| 15 |
+
ENV APP_SECRET=your_app_secret_here
|
| 16 |
|
| 17 |
+
# Expose the port
|
| 18 |
+
EXPOSE 8001
|
|
|
|
| 19 |
|
| 20 |
+
# Run the application
|
| 21 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"]
|