Update Dockerfile

#1
by Redmind - opened
Files changed (1) hide show
  1. Dockerfile +10 -33
Dockerfile CHANGED
@@ -1,40 +1,17 @@
1
- ## Use the official Python 3.9 image
2
- FROM python:3.10
3
 
4
- # ENV http_proxy="http://130.162.148.105:8080"
5
- # ENV https_proxy="http://72.10.164.178:1417"
6
- # ENV no_proxy="localhost,127.0.0.1"
7
 
8
- ## set the working directory to /code
9
- WORKDIR /code
10
-
11
- ## Copy the current directory contents in the container at /code
12
- COPY ./requirements.txt /code/requirements.txt
13
-
14
- ## Install the requirements.txt
15
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
16
- RUN pip install --no-cache-dir --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
17
-
18
-
19
- # Set up a new user named "user"
20
- RUN useradd user
21
- # Switch to the "user" user
22
  USER user
 
23
 
24
- # Set home to the user's home directory
25
-
26
- ENV HOME=/home/user \
27
- PATH=/home/user/.local/bin:$PATH
28
-
29
- # Set the working directory to the user's home directory
30
- WORKDIR $HOME/app
31
-
32
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
33
- COPY --chown=user . $HOME/app
34
 
 
 
35
 
36
- # Verify files copied correctly by listing them
37
- RUN ls -la $HOME/app
38
 
39
- ## Start the FASTAPI App on port 7860
40
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
 
4
+ FROM python:3.9
 
 
5
 
6
+ RUN useradd -m -u 1000 user
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  USER user
8
+ ENV PATH="/home/user/.local/bin:$PATH"
9
 
10
+ WORKDIR /app
 
 
 
 
 
 
 
 
 
11
 
12
+ COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
15
+ COPY --chown=user . /app
 
16
 
17
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]