Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
jahnavi-maddhuri committed Dec 13, 2024
1 parent b79aa4c commit 88730f0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 16 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# Build the Docker image
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/jahnavi-docker-app:latest .

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/jahnavi-docker-app:latest
# Push the Docker image to Docker Hub
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/jahnavi-docker-app:latest
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ EXPOSE 5000
ENV FLASK_APP=app.py

# run flask app
CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"]
# CMD ["python", "app.py"]
# CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"]
CMD ["python", "app.py"]
39 changes: 35 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
from flask import Flask
from flask import (
Flask,
request,
render_template_string,
)
from dotenv import load_dotenv

load_dotenv()

app = Flask(__name__)

@app.route('/')
HTML_TEMPLATE = """
<!DOCTYPE html>
<html>
<head>
<title>Movie Request Form</title>
</head>
<body>
<h1>Enter Your Details</h1>
<form method="POST" action="/">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<label for="genre">Genre:</label>
<input type="text" id="genre" name="genre" required><br><br>
<label for="mood">Mood:</label>
<input type="text" id="mood" name="mood" required><br><br>
<button type="submit">Submit</button>
</form>
</body>
</html>
"""

@app.route('/', methods=["GET", "POST"])

def hello_world():
return 'Hello, World!'
if request.method == "POST":
return f"<h1>Hello World!</h1>"
return render_template_string(HTML_TEMPLATE)

if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
app.run(host='0.0.0.0', port=5000, debug=True)
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ pytest
pytest-cov
pylint
ruff
Flask==2.0.1
Flask==2.0.1
Werkzeug==2.0.1
python-dotenv

0 comments on commit 88730f0

Please sign in to comment.