Spaces:
Runtime error
Runtime error
Ajeet Singh Raina
commited on
Commit
·
29d620f
1
Parent(s):
afcfdf4
Added
Browse files- Dockerfile +9 -23
Dockerfile
CHANGED
@@ -1,34 +1,20 @@
|
|
1 |
-
FROM python:3.
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
### Set up user with permissions
|
4 |
-
# Set up a new user named "user" with user ID 1000
|
5 |
RUN useradd -m -u 1000 user
|
6 |
|
7 |
-
# Switch to the "user" user
|
8 |
USER user
|
9 |
|
10 |
-
# Set home to the user's home directory
|
11 |
ENV HOME=/home/user \
|
12 |
-
|
13 |
|
14 |
-
# Set the working directory to the user's home directory
|
15 |
WORKDIR $HOME/app
|
16 |
|
17 |
-
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
18 |
COPY --chown=user . $HOME/app
|
19 |
|
20 |
-
|
21 |
-
COPY requirements.txt requirements.txt
|
22 |
-
RUN pip3 install -r requirements.txt
|
23 |
-
|
24 |
-
COPY . .
|
25 |
-
|
26 |
-
### Update permissions for the app
|
27 |
-
USER root
|
28 |
-
RUN chmod 777 ~/app/*
|
29 |
-
USER user
|
30 |
-
|
31 |
-
EXPOSE 7860 7860
|
32 |
-
|
33 |
-
ENTRYPOINT ["python3"]
|
34 |
-
CMD ["app.py"]
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
|
5 |
+
COPY ./requirements.txt /code/requirements.txt
|
6 |
+
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
|
|
|
|
9 |
RUN useradd -m -u 1000 user
|
10 |
|
|
|
11 |
USER user
|
12 |
|
|
|
13 |
ENV HOME=/home/user \
|
14 |
+
PATH=/home/user/.local/bin:$PATH
|
15 |
|
|
|
16 |
WORKDIR $HOME/app
|
17 |
|
|
|
18 |
COPY --chown=user . $HOME/app
|
19 |
|
20 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|