-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (45 loc) · 1.59 KB
/
Copy pathbackend-pipeline.yml
File metadata and controls
57 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Pipeline for architecture
on:
push:
branches:
- main
jobs:
build_and_push:
runs-on: ubuntu-latest
defaults:
run:
working-directory: Backend
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/backend-terraform-three-tier-aws:${{ github.sha }} \
-t lavanyasharma07/backend-terraform-three-tier-aws:latest \
.
- name: Smoke Test Docker Image
run: |
docker run -d --name test-app -p 5000:5000 \
lavanyasharma07/backend-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/backend-terraform-three-tier-aws:${{ github.sha }}
docker push lavanyasharma07/backend-terraform-three-tier-aws:latest