srinidhidevaraj commited on
Commit
30ba9b2
1 Parent(s): 8c49cbf

added book

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -8
Dockerfile CHANGED
@@ -1,17 +1,49 @@
 
1
  FROM python:3.9
2
 
3
- RUN useradd -m -u 1000 user
4
-
5
  WORKDIR /app
6
 
7
- COPY --chown=user ./requirements.txt requirements.txt
 
 
 
 
 
 
 
 
 
 
8
 
9
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
10
 
11
- COPY --chown=user . /app
 
12
 
 
13
  EXPOSE 5000
14
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app", "--workers=1"]
15
 
16
- # CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
17
- # CMD ["gunicorn", "--host", "0.0.0.0:7860", "main:app"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python base image
2
  FROM python:3.9
3
 
4
+ # Set the working directory in the container
 
5
  WORKDIR /app
6
 
7
+ # Copy the requirements.txt file and install the Python dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Set up a new user named "user" with user ID 1000
12
+ RUN useradd -m -u 1000 user
13
+ # Switch to the "user" user
14
+ USER user
15
+ # Set home to the user's home directory
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
 
19
+ # Set the working directory to the user's home directory
20
+ WORKDIR $HOME/app
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
+ # Expose the port on which the Flask application will run
26
  EXPOSE 5000
 
27
 
28
+ # Set the environment variable for Flask
29
+ ENV FLASK_APP=api_server.py
30
+
31
+ # Run the Flask application
32
+ CMD ["flask", "run", "--host=0.0.0.0"]
33
+ # FROM python:3.9
34
+
35
+ # RUN useradd -m -u 1000 user
36
+
37
+ # WORKDIR /app
38
+
39
+ # COPY --chown=user ./requirements.txt requirements.txt
40
+
41
+ # RUN pip install --no-cache-dir --upgrade -r requirements.txt
42
+
43
+ # COPY --chown=user . /app
44
+
45
+ # EXPOSE 5000
46
+ # CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app", "--workers=1"]
47
+
48
+ # # CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
49
+ # # CMD ["gunicorn", "--host", "0.0.0.0:7860", "main:app"]