File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed
Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 1- FROM python:3.13-alpine
2- LABEL maintainer="lorenz.vanthillo@gmail.com"
3- COPY . /app
1+ # FROM python:3.13-alpine
2+ # LABEL maintainer="bujjisreenivasulu@gmail.com"
3+ # WORKDIR /app
4+ # COPY . /app
5+ # RUN pip install -r requirements.txt
6+ # ENV APP_PORT=8080
7+ # EXPOSE 8080
8+ # ENTRYPOINT ["python"]
9+ # CMD ["src/app.py"]
10+
11+ FROM python
412WORKDIR /app
13+ COPY requirements.txt .
514RUN pip install -r requirements.txt
6- EXPOSE 8080
15+ COPY . .
16+ ARG APP_PORT=7070
17+ ENV APP_PORT ${APP_PORT}
18+ EXPOSE 7070
719ENTRYPOINT ["python" ]
8- CMD ["src/app.py" ]
20+ CMD ["src/app.py" ]
Original file line number Diff line number Diff line change @@ -34,4 +34,12 @@ $ docker inspect -f '{{ .Config.Hostname }}' my-container
34346095273a4e9b
3535```
3636
37+ ### Run below commands to deploy in DOcker Desktop
38+ 1 . git clone <url >
39+ 2 . cd <repoName >
40+ 3 . Update Docker file
41+ 4 . docker build --build-arg APP_PORT=7070 -t pyflask:1 .
42+ 5 . docker run -d -p 8080:8080 pyflask:1
43+ 6 . docker rm -f $(docker ps -aq) ; docker rmi -f $(docker images -q) --> !! Careful !! To delete all images & Containers
44+
3745
Original file line number Diff line number Diff line change 11from flask import Flask , render_template
22import socket
3+ import os
34
45app = Flask (__name__ )
56
@@ -15,4 +16,5 @@ def index():
1516
1617
1718if __name__ == "__main__" :
18- app .run (host = "0.0.0.0" , port = 8080 )
19+ port = int (os .environ .get ("APP_PORT" , 8080 ))
20+ app .run (host = "0.0.0.0" , port = port )
You can’t perform that action at this time.
0 commit comments