saicharan1234 commited on
Commit
073fb1e
·
1 Parent(s): 4de1772

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -20
Dockerfile CHANGED
@@ -1,38 +1,29 @@
1
  FROM python:3.10.12
2
 
3
- # Set up a new user named "user" with user ID 1000
 
 
 
 
 
 
4
  RUN useradd -m -u 1000 user
5
 
6
- # Switch to the "user" user
7
  USER user
8
 
9
- # Set home to the user's home directory
10
  ENV HOME=/home/user \
11
  PATH=/home/user/.local/bin:$PATH
12
 
13
- # Set the working directory to the user's home directory
14
  WORKDIR $HOME/app
15
 
16
- # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
17
- RUN pip install --no-cache-dir --upgrade pip
18
-
19
- # Copy the requirements file to the container
20
- COPY --chown=user requirements.txt .
21
-
22
- # Install dependencies
23
- RUN pip install -r requirements.txt
24
 
25
- # Copy the rest of the project files to the container
26
- COPY --chown=user main.py .
27
-
28
- # Create a directory named "yo"
29
- RUN mkdir yo
30
-
31
- # Set TRANSFORMERS_CACHE to /app/yo
32
- ENV TRANSFORMERS_CACHE=/app/yo
33
 
34
  # Expose the port that the application will be running on
35
  EXPOSE 8000
36
 
37
  # Run the application
38
  CMD ["uvicorn", "main:app"]
 
 
 
 
1
  FROM python:3.10.12
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
+
10
  RUN useradd -m -u 1000 user
11
 
 
12
  USER user
13
 
 
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
 
 
17
  WORKDIR $HOME/app
18
 
19
+ COPY --chown=user . $HOME/app
 
 
 
 
 
 
 
20
 
 
 
 
 
 
 
 
 
21
 
22
  # Expose the port that the application will be running on
23
  EXPOSE 8000
24
 
25
  # Run the application
26
  CMD ["uvicorn", "main:app"]
27
+
28
+
29
+