Change in the folder location of the .py file
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
-
# Copy and install
|
| 6 |
COPY ./requirements.txt /code/requirements.txt
|
| 7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
|
| 9 |
-
# Copy
|
| 10 |
-
|
| 11 |
-
# If main.py is in the root, change the next line to: COPY ./main.py /code/
|
| 12 |
-
COPY ./app /code/app
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
CMD ["uvicorn", "
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Copy the requirements file and install dependencies
|
| 8 |
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 10 |
|
| 11 |
+
# Copy the main application file from the root directory
|
| 12 |
+
COPY ./main.py /code/main.py
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Command to run the app. Note we use "main:app" instead of "app.main:app"
|
| 15 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|