Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +28 -20
Dockerfile
CHANGED
|
@@ -1,20 +1,28 @@
|
|
| 1 |
-
FROM python:3.10
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10
|
| 2 |
+
|
| 3 |
+
# Set the working directory inside the container
|
| 4 |
+
WORKDIR /ASF
|
| 5 |
+
|
| 6 |
+
# Copy the requirements file and install dependencies
|
| 7 |
+
COPY ./requirements.txt /ASF/requirements.txt
|
| 8 |
+
RUN pip install --no-cache-dir --upgrade -r /ASF/requirements.txt
|
| 9 |
+
|
| 10 |
+
# Create a user and switch to it
|
| 11 |
+
RUN useradd user
|
| 12 |
+
USER user
|
| 13 |
+
|
| 14 |
+
# Set environment variables
|
| 15 |
+
ENV HOME=/home/user \
|
| 16 |
+
PATH=/home/user/.local/bin:$PATH
|
| 17 |
+
|
| 18 |
+
# Set the working directory for the app
|
| 19 |
+
WORKDIR $HOME/app
|
| 20 |
+
|
| 21 |
+
# Copy the application code into the container
|
| 22 |
+
COPY --chown=user . $HOME/app
|
| 23 |
+
|
| 24 |
+
# Ensure the templates folder is copied (make sure it exists in your local project structure)
|
| 25 |
+
COPY ./templates /home/user/app/templates
|
| 26 |
+
|
| 27 |
+
# Set the command to run the FastAPI app
|
| 28 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--root-path", "/"]
|