Skip to content

Commit 398bd9a

Browse files
author
Sreenu4Cherry
committed
updated
1 parent 15c9ed3 commit 398bd9a

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

Dockerfile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
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
412
WORKDIR /app
13+
COPY requirements.txt .
514
RUN pip install -r requirements.txt
6-
EXPOSE 8080
15+
COPY . .
16+
ARG APP_PORT=7070
17+
ENV APP_PORT ${APP_PORT}
18+
EXPOSE 7070
719
ENTRYPOINT ["python"]
8-
CMD ["src/app.py"]
20+
CMD ["src/app.py"]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ $ docker inspect -f '{{ .Config.Hostname }}' my-container
3434
6095273a4e9b
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

src/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from flask import Flask, render_template
22
import socket
3+
import os
34

45
app = Flask(__name__)
56

@@ -15,4 +16,5 @@ def index():
1516

1617

1718
if __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)

0 commit comments

Comments
 (0)