Skip to content

Correction in app.py #6

Correction in app.py

Correction in app.py #6

name: Pipeline for architecture
on:
push:
branches:
- main
jobs:
build_and_push:
runs-on: ubuntu-latest
defaults:
run:
working-directory: Frontend
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Python version
run: python --version
- name: Install Requirements
run: pip install -r requirements.txt
- name: Verify app loads
run: python -c "from app import app"
- name: Login to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build docker Image
run: |
docker build \
-t lavanyasharma07/frontend-terraform-three-tier-aws:${{ github.sha }} \
-t lavanyasharma07/frontend-terraform-three-tier-aws:latest \
.
- name: Smoke Test Docker Image
run: |
docker run -d --name test-app -p 5000:5000 \
lavanyasharma07/frontend-terraform-three-tier-aws:${{ github.sha }}
sleep 20
curl -v http://localhost:5000/health
docker logs test-app
docker rm -f test-app
- name: Push Docker image
run: |
docker push lavanyasharma07/frontend-terraform-three-tier-aws:${{ github.sha }}
docker push lavanyasharma07/frontend-terraform-three-tier-aws:latest