Skip to content

Feature/test #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
FROM python:3.13-alpine
LABEL maintainer="lorenz.vanthillo@gmail.com"
COPY . /app
# FROM python:3.13-alpine
# LABEL maintainer="bujjisreenivasulu@gmail.com"
# WORKDIR /app
# COPY . /app
# RUN pip install -r requirements.txt
# ENV APP_PORT=8080
# EXPOSE 8080
# ENTRYPOINT ["python"]
# CMD ["src/app.py"]

FROM python
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
EXPOSE 8080
COPY . .
ARG APP_PORT=7070
ENV APP_PORT ${APP_PORT}
EXPOSE 7070
ENTRYPOINT ["python"]
CMD ["src/app.py"]
CMD ["src/app.py"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@ $ docker inspect -f '{{ .Config.Hostname }}' my-container
6095273a4e9b
```

### Run below commands to deploy in DOcker Desktop
1. git clone <url>
2. cd <repoName>
3. Update Docker file
4. docker build --build-arg APP_PORT=7070 -t pyflask:1 .
5. docker run -d -p 8080:8080 pyflask:1
6. docker rm -f $(docker ps -aq) ; docker rmi -f $(docker images -q) --> !! Careful !! To delete all images & Containers
7. git add . ; git commit -m "updated" ; git push origin feature/test


4 changes: 3 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import Flask, render_template
import socket
import os

app = Flask(__name__)

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


if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)
port = int(os.environ.get("APP_PORT", 8080))
app.run(host="0.0.0.0", port=port)