File tree 6 files changed +37
-27
lines changed
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 15
15
16
16
- name : Build Docker Image
17
17
run : |
18
- docker build -t awesome -fastapi:${{ github.sha }} .
18
+ docker build -t python -fastapi:${{ github.sha }} .
19
19
Original file line number Diff line number Diff line change 1
1
name : Main Workflow
2
2
on :
3
3
push :
4
-
4
+ branches :
5
+ - main
5
6
workflow_dispatch :
6
7
7
8
permissions :
@@ -11,19 +12,18 @@ permissions:
11
12
id-token : write
12
13
packages : write
13
14
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
18
18
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 7
7
env :
8
8
# Use docker.io for Docker Hub if empty
9
9
REGISTRY : ghcr.io
10
- IMAGE_NAME : ' awesome -fastapi'
10
+ IMAGE_NAME : ' python -fastapi'
11
11
12
12
13
13
jobs :
Original file line number Diff line number Diff line change 1
- name : Unit and Security Testing
1
+ name : Unit and Security Scanning
2
2
on :
3
3
workflow_call :
4
4
7
7
testing_phase :
8
8
name : Run unit test
9
9
runs-on : ubuntu-latest
10
+ needs : ['trivy_scans', 'owasp_zap_scan'] # Ensure this job runs after the security scans
10
11
11
12
steps :
12
13
- name : Checkout repository
@@ -29,12 +30,12 @@ jobs:
29
30
30
31
- name : Build Docker Image
31
32
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--##
33
34
34
35
- name : Run Trivy Vulnerability Scanner
35
36
uses :
aquasecurity/[email protected]
36
37
with :
37
- image-ref : ' awesome -fastapi:${{ github.sha }}'
38
+ image-ref : ' python -fastapi:${{ github.sha }}'
38
39
format : ' sarif'
39
40
output : ' trivy-results.sarif'
40
41
severity : ' CRITICAL,HIGH'
55
56
# Run Docker Image in detached mode
56
57
- name : Build Docker Image
57
58
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 }}
60
61
61
62
- name : Wait for Docker container to be ready
62
63
run : sleep 30
Original file line number Diff line number Diff line change @@ -36,24 +36,24 @@ gcp-python-fastapi/
36
36
If you haven't cloned the project yet, use the following command:
37
37
38
38
``` 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
41
41
```
42
42
43
43
### 2. Build the Docker image
44
44
45
45
To build the Docker image, run the following command in the root of the project directory:
46
46
47
47
``` bash
48
- docker build -t awesome -fastapi .
48
+ docker build -t python -fastapi .
49
49
```
50
50
51
51
### 3. Run the Docker container
52
52
53
53
After the image is built, run the container:
54
54
55
55
``` bash
56
- docker run -d -p 80:80 awesome -fastapi
56
+ docker run -d -p 80:80 python -fastapi
57
57
```
58
58
59
59
This command will run the FastAPI app on port 80 of your localhost.
You can’t perform that action at this time.
0 commit comments