Spaces:
Sleeping
Sleeping
update Dockerfile
Browse files- Dockerfile +18 -10
Dockerfile
CHANGED
@@ -2,22 +2,30 @@
|
|
2 |
FROM python:3.9
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
-
WORKDIR /
|
6 |
|
7 |
-
# Copy the
|
8 |
-
COPY requirements.txt .
|
9 |
|
10 |
-
# Install
|
11 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
# Install en_core_web_sm
|
14 |
RUN pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0.tar.gz --user
|
15 |
|
16 |
-
#
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
#
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
# Start the FastAPI app using Uvicorn
|
23 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "
|
|
|
2 |
FROM python:3.9
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
+
WORKDIR /code
|
6 |
|
7 |
+
# Copy the current directory contents into the container at /code
|
8 |
+
COPY ./requirements.txt /code/requirements.txt
|
9 |
|
10 |
+
# Install requirements.txt
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
|
13 |
# Install en_core_web_sm
|
14 |
RUN pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0.tar.gz --user
|
15 |
|
16 |
+
# Set up a new user named "user" with user ID 1000
|
17 |
+
RUN useradd -m -u 1000 user
|
18 |
+
# Switch to the "user" user
|
19 |
+
USER user
|
20 |
+
# Set home to the user's home directory
|
21 |
+
ENV HOME=/home/user \
|
22 |
+
PATH=/home/user/.local/bin:$PATH
|
23 |
|
24 |
+
# Set the working directory to the user's home directory
|
25 |
+
WORKDIR $HOME/app
|
26 |
+
|
27 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
28 |
+
COPY --chown=user . $HOME/app
|
29 |
|
30 |
# Start the FastAPI app using Uvicorn
|
31 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|