From 88730f0612f52a29f53dfca353805aa13692d15a Mon Sep 17 00:00:00 2001 From: Jahnavi Maddhuri Date: Fri, 13 Dec 2024 12:59:50 -0800 Subject: [PATCH] try --- .github/workflows/cicd.yml | 17 ++++++++--------- Dockerfile | 4 ++-- app.py | 39 ++++++++++++++++++++++++++++++++++---- requirements.txt | 4 +++- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index d104e53..7428a16 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -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 \ No newline at end of file + # Push the Docker image to Docker Hub + - name: Push Docker image + run: docker push ${{ secrets.DOCKER_USERNAME }}/jahnavi-docker-app:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7adff4b..c44854f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/app.py b/app.py index 9f7ddbc..7a40e38 100644 --- a/app.py +++ b/app.py @@ -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 = """ + + + + Movie Request Form + + +

Enter Your Details

+
+ +

+ +

+ +

+ +
+ + +""" + +@app.route('/', methods=["GET", "POST"]) + def hello_world(): - return 'Hello, World!' + if request.method == "POST": + return f"

Hello World!

" + return render_template_string(HTML_TEMPLATE) if __name__ == '__main__': - app.run(host='0.0.0.0', port=5000) \ No newline at end of file + app.run(host='0.0.0.0', port=5000, debug=True) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 52bc800..bd82ef5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,6 @@ pytest pytest-cov pylint ruff -Flask==2.0.1 \ No newline at end of file +Flask==2.0.1 +Werkzeug==2.0.1 +python-dotenv \ No newline at end of file