Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +18 -18
Dockerfile
CHANGED
|
@@ -1,28 +1,28 @@
|
|
| 1 |
-
# Use the official Python 3.9 image
|
| 2 |
FROM python:3.9
|
| 3 |
-
|
| 4 |
# Set the working directory to /code
|
| 5 |
WORKDIR /code
|
| 6 |
-
|
| 7 |
-
# Copy the current directory contents into the container at /code
|
| 8 |
-
COPY .
|
| 9 |
-
|
| 10 |
-
# Install requirements.txt
|
| 11 |
-
RUN pip install --no-cache-dir -
|
| 12 |
-
|
| 13 |
-
# Set up a new user named "
|
| 14 |
-
RUN useradd -m -u 1000
|
| 15 |
-
# Switch to the "
|
| 16 |
USER uss
|
| 17 |
# Set home to the user's home directory
|
| 18 |
ENV HOME=/home/uss
|
| 19 |
-
|
| 20 |
-
|
|
|
|
| 21 |
# Set the working directory to the user's home directory
|
| 22 |
WORKDIR $HOME/app
|
| 23 |
-
|
| 24 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 25 |
-
COPY --chown=
|
| 26 |
-
|
| 27 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
| 28 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9
|
| 2 |
+
|
| 3 |
# Set the working directory to /code
|
| 4 |
WORKDIR /code
|
| 5 |
+
|
| 6 |
+
# Copy the current directory contents into the container at /code, and change permissions for user "uss"
|
| 7 |
+
COPY --chown=uss . /code
|
| 8 |
+
|
| 9 |
+
# Install requirements.txt
|
| 10 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
+
|
| 12 |
+
# Set up a new user named "uss" with user ID 1000
|
| 13 |
+
RUN useradd -m -u 1000 uss
|
| 14 |
+
# Switch to the "uss" user
|
| 15 |
USER uss
|
| 16 |
# Set home to the user's home directory
|
| 17 |
ENV HOME=/home/uss
|
| 18 |
+
# Set PATH for the user (assuming .local/bin exists in the user's home directory)
|
| 19 |
+
ENV PATH=$HOME/.local/bin:$PATH
|
| 20 |
+
|
| 21 |
# Set the working directory to the user's home directory
|
| 22 |
WORKDIR $HOME/app
|
| 23 |
+
|
| 24 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 25 |
+
COPY --chown=uss . $HOME/app
|
| 26 |
+
|
| 27 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
| 28 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|