Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +9 -10
Dockerfile
CHANGED
@@ -3,29 +3,28 @@ FROM python:3.9
|
|
3 |
|
4 |
RUN apt-get update -y && apt-get install -y build-essential
|
5 |
|
6 |
-
# Set the working directory to /code
|
7 |
-
WORKDIR /code
|
8 |
-
|
9 |
-
# Copy the current directory contents into the container at /code
|
10 |
-
COPY ./requirements.txt /code/requirements.txt
|
11 |
-
|
12 |
-
# Install requirements.txt
|
13 |
-
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
14 |
-
|
15 |
# Set up a new user named "user" with user ID 1000
|
16 |
RUN useradd -m -u 1000 user
|
|
|
17 |
# Switch to the "user" user
|
18 |
USER user
|
|
|
19 |
# Set home to the user's home directory
|
20 |
ENV HOME=/home/user \
|
21 |
-
PATH=/home/user/.local/bin
|
22 |
|
23 |
# Set the working directory to the user's home directory
|
24 |
WORKDIR $HOME/app
|
25 |
|
|
|
|
|
|
|
26 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
27 |
COPY --chown=user . $HOME/app
|
28 |
|
|
|
|
|
|
|
29 |
EXPOSE 7860
|
30 |
|
31 |
ENTRYPOINT ["python" "-m" "flask" "run" "-p" "7860" "-h" "0.0.0.0"]
|
|
|
3 |
|
4 |
RUN apt-get update -y && apt-get install -y build-essential
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# Set up a new user named "user" with user ID 1000
|
7 |
RUN useradd -m -u 1000 user
|
8 |
+
|
9 |
# Switch to the "user" user
|
10 |
USER user
|
11 |
+
|
12 |
# Set home to the user's home directory
|
13 |
ENV HOME=/home/user \
|
14 |
+
PATH=/home/user/.local/bin:$PATH
|
15 |
|
16 |
# Set the working directory to the user's home directory
|
17 |
WORKDIR $HOME/app
|
18 |
|
19 |
+
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
20 |
+
RUN pip install --no-cache-dir --upgrade pip
|
21 |
+
|
22 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
23 |
COPY --chown=user . $HOME/app
|
24 |
|
25 |
+
|
26 |
+
RUN pip install --no-cache-dir -r ./requirements.tct
|
27 |
+
|
28 |
EXPOSE 7860
|
29 |
|
30 |
ENTRYPOINT ["python" "-m" "flask" "run" "-p" "7860" "-h" "0.0.0.0"]
|