Update Dockerfile
Browse files- Dockerfile +11 -7
Dockerfile
CHANGED
@@ -14,12 +14,17 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-reco
|
|
14 |
ninja-build \
|
15 |
libopenblas-dev \
|
16 |
build-essential
|
|
|
|
|
|
|
|
|
17 |
|
|
|
18 |
RUN mkdir /app
|
19 |
WORKDIR /app
|
|
|
20 |
COPY . .
|
21 |
|
22 |
-
RUN python3 -m pip install --upgrade pip
|
23 |
|
24 |
# Set environment variable for the host
|
25 |
ENV HOST=0.0.0.0
|
@@ -27,22 +32,21 @@ ENV PORT=7860
|
|
27 |
ENV ORIGINS=*
|
28 |
ENV TF_ENABLE_ONEDNN_OPTS=0
|
29 |
|
30 |
-
|
31 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
32 |
|
33 |
# Set up a new user named "user" with user ID 1000
|
34 |
RUN useradd -m -u 1000 user
|
35 |
# Switch to the "user" user
|
36 |
-
|
37 |
# Set home to the user's home directory
|
38 |
ENV HOME=/home/user \
|
39 |
-
PATH=/home/user/.local/bin:$PATH
|
40 |
|
41 |
# Set the working directory to the user's home directory
|
42 |
#WORKDIR $HOME/app
|
43 |
-
|
44 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
45 |
-
COPY --chown=user . $HOME
|
46 |
#CMD ["python3", "-m", "app"]
|
47 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
48 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
14 |
ninja-build \
|
15 |
libopenblas-dev \
|
16 |
build-essential
|
17 |
+
|
18 |
+
RUN python3 -m pip install --upgrade pip
|
19 |
+
# Install requirements.txt
|
20 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
21 |
|
22 |
+
RUN useradd -ms /bin/bash user
|
23 |
RUN mkdir /app
|
24 |
WORKDIR /app
|
25 |
+
|
26 |
COPY . .
|
27 |
|
|
|
28 |
|
29 |
# Set environment variable for the host
|
30 |
ENV HOST=0.0.0.0
|
|
|
32 |
ENV ORIGINS=*
|
33 |
ENV TF_ENABLE_ONEDNN_OPTS=0
|
34 |
|
35 |
+
|
|
|
36 |
|
37 |
# Set up a new user named "user" with user ID 1000
|
38 |
RUN useradd -m -u 1000 user
|
39 |
# Switch to the "user" user
|
40 |
+
USER user
|
41 |
# Set home to the user's home directory
|
42 |
ENV HOME=/home/user \
|
43 |
+
PATH=/home/user/.local/bin:$PATH/app
|
44 |
|
45 |
# Set the working directory to the user's home directory
|
46 |
#WORKDIR $HOME/app
|
47 |
+
RUN chmod 755 /app
|
48 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
49 |
+
COPY --chown=user . $HOME/app
|
50 |
#CMD ["python3", "-m", "app"]
|
51 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
52 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|