File tree Expand file tree Collapse file tree 6 files changed +37
-27
lines changed
Expand file tree Collapse file tree 6 files changed +37
-27
lines changed Original file line number Diff line number Diff line change 1+ # Set update schedule for GitHub Actions
2+ version : 2
3+ updates :
4+
5+ - package-ecosystem : " github-actions"
6+ directory : " /"
7+ schedule :
8+ # Check for updates to GitHub Actions every week
9+ interval : " daily"
Original file line number Diff line number Diff line change 1515
1616 - name : Build Docker Image
1717 run : |
18- docker build -t awesome -fastapi:${{ github.sha }} .
18+ docker build -t python -fastapi:${{ github.sha }} .
1919
Original file line number Diff line number Diff line change 11name : Main Workflow
22on :
33 push :
4-
4+ branches :
5+ - main
56 workflow_dispatch :
67
78permissions :
@@ -11,19 +12,18 @@ permissions:
1112 id-token : write
1213 packages : write
1314
14-
15- jobs :
16- build-image :
17- uses : ./.github/workflows/build-image.yml
15+ jobs :
16+ build-image :
17+ uses : ./.github/workflows/build-image.yml
1818
19- lint-format :
20- uses : ./.github/workflows/lint-format.yml
21- needs : build-image
22-
23- unit-sec-scan :
24- uses : ./.github/workflows/unit-sec-test.yml
25- needs : lint-format
26-
27- push-docker-image :
28- uses : ./.github/workflows/push-docker-image.yml
29- needs : unit-sec-scan
19+ lint-format :
20+ uses : ./.github/workflows/lint-format.yml
21+ needs : build-image
22+
23+ unit-sec-scan :
24+ uses : ./.github/workflows/unit-sec-test.yml
25+ needs : lint-format
26+
27+ push-docker-image :
28+ uses : ./.github/workflows/push-docker-image.yml
29+ needs : unit-sec-scan
Original file line number Diff line number Diff line change 77env :
88 # Use docker.io for Docker Hub if empty
99 REGISTRY : ghcr.io
10- IMAGE_NAME : ' awesome -fastapi'
10+ IMAGE_NAME : ' python -fastapi'
1111
1212
1313jobs :
Original file line number Diff line number Diff line change 1- name : Unit and Security Testing
1+ name : Unit and Security Scanning
22on :
33 workflow_call :
44
77 testing_phase :
88 name : Run unit test
99 runs-on : ubuntu-latest
10+ needs : ['trivy_scans', 'owasp_zap_scan'] # Ensure this job runs after the security scans
1011
1112 steps :
1213 - name : Checkout repository
@@ -29,12 +30,12 @@ jobs:
2930
3031 - name : Build Docker Image
3132 run : |
32- docker build -t awesome -fastapi:${{ github.sha }} . ###- This section needed to be added becasue the image was not persisting between jobs--##
33+ docker build -t python -fastapi:${{ github.sha }} . ###- This section needed to be added becasue the image was not persisting between jobs--##
3334
3435 - name : Run Trivy Vulnerability Scanner
3536 uses :
aquasecurity/[email protected] 3637 with :
37- image-ref : ' awesome -fastapi:${{ github.sha }}'
38+ image-ref : ' python -fastapi:${{ github.sha }}'
3839 format : ' sarif'
3940 output : ' trivy-results.sarif'
4041 severity : ' CRITICAL,HIGH'
5556 # Run Docker Image in detached mode
5657 - name : Build Docker Image
5758 run : |
58- docker build -t awesome -fastapi:${{ github.sha }} .
59- docker run -d -p 8080:8080 awesome -fastapi:${{ github.sha }}
59+ docker build -t python -fastapi:${{ github.sha }} .
60+ docker run -d -p 8080:8080 python -fastapi:${{ github.sha }}
6061
6162 - name : Wait for Docker container to be ready
6263 run : sleep 30
Original file line number Diff line number Diff line change @@ -36,24 +36,24 @@ gcp-python-fastapi/
3636If you haven't cloned the project yet, use the following command:
3737
3838``` bash
39- git clone https://github.com/your-username/awesome -fastapi.git
40- cd awesome -fastapi
39+ git clone https://github.com/your-username/python -fastapi.git
40+ cd python -fastapi
4141```
4242
4343### 2. Build the Docker image
4444
4545To build the Docker image, run the following command in the root of the project directory:
4646
4747``` bash
48- docker build -t awesome -fastapi .
48+ docker build -t python -fastapi .
4949```
5050
5151### 3. Run the Docker container
5252
5353After the image is built, run the container:
5454
5555``` bash
56- docker run -d -p 80:80 awesome -fastapi
56+ docker run -d -p 80:80 python -fastapi
5757```
5858
5959This command will run the FastAPI app on port 80 of your localhost.
You can’t perform that action at this time.
0 commit comments