Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a slim and modern Python base image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory inside the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy the requirements file first to leverage Docker's layer caching
|
| 8 |
+
COPY requirements.txt .
|
| 9 |
+
|
| 10 |
+
# Install dependencies, including build tools for uvloop, then clean up
|
| 11 |
+
# --no-cache-dir reduces image size
|
| 12 |
+
RUN apt-get update && apt-get install -y build-essential && \
|
| 13 |
+
pip install --no-cache-dir -r requirements.txt && \
|
| 14 |
+
apt-get purge -y --auto-remove build-essential && \
|
| 15 |
+
rm -rf /var/lib/apt/lists/*
|
| 16 |
+
|
| 17 |
+
# Copy the rest of the application code
|
| 18 |
+
COPY phoenix_fury_api.py .
|
| 19 |
+
|
| 20 |
+
# Expose the port the API will run on
|
| 21 |
+
EXPOSE 8000
|
| 22 |
+
|
| 23 |
+
# Set the command to run the application using uvicorn
|
| 24 |
+
# Using --workers 1 because we are managing parallelism with multiprocessing in Python
|
| 25 |
+
CMD ["uvicorn", "phoenix_fury_api:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|