Create Dockerfile
Browse files- Dockerfile +21 -0
Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Upgrade pip and install FastAPI, Uvicorn, and Jinja2
|
| 8 |
+
RUN pip install --upgrade pip && \
|
| 9 |
+
pip install fastapi uvicorn[standard] jinja2
|
| 10 |
+
|
| 11 |
+
# Copy the current directory contents into the container at /app
|
| 12 |
+
COPY . /app
|
| 13 |
+
|
| 14 |
+
# Expose port 7860 for the application
|
| 15 |
+
EXPOSE 7860
|
| 16 |
+
|
| 17 |
+
# Define environment variable for the default port (optional)
|
| 18 |
+
ENV PORT 7860
|
| 19 |
+
|
| 20 |
+
# Run the FastAPI app using Uvicorn on host 0.0.0.0 and port 7860
|
| 21 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|