Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Step 1: Use an official Python image as a base
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# Step 2: Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Step 3: Copy the requirements.txt file to the working directory
|
8 |
+
COPY requirements.txt /app/
|
9 |
+
|
10 |
+
# Step 4: Install dependencies
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Step 5: Copy the rest of the application code
|
14 |
+
COPY . /app/
|
15 |
+
|
16 |
+
# Step 6: Expose the port the app will run on
|
17 |
+
EXPOSE 7860
|
18 |
+
|
19 |
+
# Step 7: Set environment variable (if you need .env file handling)
|
20 |
+
# You can optionally copy the .env file if you're using it for environment variables
|
21 |
+
# COPY .env /app/
|
22 |
+
|
23 |
+
# Step 8: Run the application using uvicorn (FastAPI)
|
24 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|