darshan8950 commited on
Commit
f15e88e
·
1 Parent(s): 76408eb
Dockerfile CHANGED
@@ -10,8 +10,11 @@ ENV HOME=/ \
10
  # Switch to the user's home directory
11
  WORKDIR $HOME
12
 
13
- # Copy the application files into the user's home directory
14
- COPY --chown=user:user . $HOME
 
 
 
15
 
16
  # Copy the requirements file to the /code directory
17
  COPY ./requirements.txt /code/requirements.txt
@@ -23,20 +26,19 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
23
  RUN mkdir -p $HOME/.cache && chmod 777 $HOME/.cache && chown user:user $HOME/.cache
24
 
25
  # Create the database file and set permissions
26
- RUN touch $HOME/users.db && chmod 777 $HOME/users.db && chown user:user $HOME/users.db
27
 
28
  # Change ownership of mentor.txt and temp_mentor.txt
29
- RUN chown user:user $HOME/mentor.txt $HOME/temp_mentor.txt
30
 
31
- RUN ps aux | grep users.db
 
32
 
33
  # Switch back to the user
34
  USER user
35
 
36
  # Set the working directory for the application
37
- WORKDIR $HOME
38
-
39
- RUN pwd && ls -l
40
 
41
  # Start the application using gunicorn
42
  CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "--timeout", "300", "main:app"]
 
10
  # Switch to the user's home directory
11
  WORKDIR $HOME
12
 
13
+ # Create a new directory named 'app'
14
+ RUN mkdir -p $HOME/app
15
+
16
+ # Copy the application files into the 'app' directory
17
+ COPY --chown=user:user . $HOME/app
18
 
19
  # Copy the requirements file to the /code directory
20
  COPY ./requirements.txt /code/requirements.txt
 
26
  RUN mkdir -p $HOME/.cache && chmod 777 $HOME/.cache && chown user:user $HOME/.cache
27
 
28
  # Create the database file and set permissions
29
+ RUN touch $HOME/app/users.db && chmod 777 $HOME/app/users.db && chown user:user $HOME/app/users.db
30
 
31
  # Change ownership of mentor.txt and temp_mentor.txt
32
+ RUN chown user:user $HOME/app/mentor.txt $HOME/app/temp_mentor.txt
33
 
34
+ # Change ownership of the 'app' directory
35
+ RUN chown user:user $HOME/app
36
 
37
  # Switch back to the user
38
  USER user
39
 
40
  # Set the working directory for the application
41
+ WORKDIR $HOME/app
 
 
42
 
43
  # Start the application using gunicorn
44
  CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "--timeout", "300", "main:app"]
main.py → app/main.py RENAMED
File without changes
mentor.txt → app/mentor.txt RENAMED
File without changes
temp_mentor.txt → app/temp_mentor.txt RENAMED
File without changes