Skip to content

Commit 7337e11

Browse files
docs(docker-build): fix documentation
1 parent a1f3c7c commit 7337e11

File tree

2 files changed

+38
-64
lines changed

2 files changed

+38
-64
lines changed

.github/workflows/docker-build.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ on:
77
description: "Name of Docker Image"
88
type: string
99
required: true
10+
image-tag:
11+
description: "Tag of Docker Image"
12+
default: "latest"
13+
type: string
1014
dockerfile:
1115
description: "Path to Dockerfile"
1216
default: "Dockerfile"
1317
type: string
14-
image-tag:
15-
description: "Tag of Docker Image"
16-
default: "latest"
18+
context:
19+
description: "Path to Docker Build Context"
20+
default: "."
1721
type: string
22+
registry:
23+
description: "Docker Registry"
24+
default: "docker.io"
25+
type: string
26+
push:
27+
description: "Push Docker Image to Registry"
28+
default: false
29+
type: boolean
1830
security-scan:
19-
description: "Enable Security Scan"
31+
description: "Enable Trivy Security Scan"
2032
default: true
2133
type: boolean
2234
security-report:
23-
description: "Enable Security Report"
35+
description: 'Security Report Mode (`"sarif"` | `"comment"`; ignored if `security-scan: false`)'
2436
default: "sarif"
2537
type: string
2638
hadolint:
2739
description: "Enable Hadolint"
2840
default: true
2941
type: boolean
30-
push:
31-
description: "Push Docker Image to Registry"
32-
default: false
33-
type: boolean
34-
context:
35-
description: "Path to Docker Build Context"
36-
default: "."
37-
type: string
38-
registry:
39-
description: "Docker Registry"
40-
default: "docker.io"
41-
type: string
4242
secrets:
4343
username:
4444
required: false

docker-build/README.md

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,32 @@ This reusable GitHub Actions workflow automates the process of building and push
99
- 🔐 Securely authenticates with Docker Hub using best practices
1010
- 🏗️ Builds optimized Docker images from a specified Dockerfile
1111
- 🏷️ Intelligently tags and pushes images to Docker Hub
12+
- 🔎 Scan for vulnerabilities
13+
- 👍 Lint dockerfile
1214
- 🛡️ Handles authentication securely using GitHub Secrets
1315
- 🚀 Optimizes build performance with layer caching
1416
- 📦 Supports multi-platform builds (AMD64, ARM64)
1517

1618
## ⚙️ Inputs
1719

18-
| Name | Description | Required | Default |
19-
| ------------ | ----------------------------------------------------------------------------- | -------- | -------------- |
20-
| `image-name` | Name of Docker Image (e.g., 'myimage', 'myorg/myimage') | true | - |
21-
| `image-tag` | Tag to apply to the built image (e.g., 'latest', 'v1.2.3') | No | `"latest"` |
22-
| `dockerfile` | Path to the Dockerfile to build (e.g., './Dockerfile', './docker/Dockerfile') | No | `"Dockerfile"` |
23-
| `push` | Push Docker Image to Registry | No | `false` |
20+
| Name | Description | Required | Default |
21+
| ----------------- | ---------------------------------------------------------------------------------- | -------- | -------------- |
22+
| `image-name` | Name of Docker Image (e.g., 'myimage', 'myorg/myimage') | true | - |
23+
| `image-tag` | Tag to apply to the built image (e.g., 'latest', 'v1.2.3') | No | `"latest"` |
24+
| `dockerfile` | Path to the Dockerfile to build (e.g., './Dockerfile', './docker/Dockerfile') | No | `"Dockerfile"` |
25+
| `context` | Path to Docker Build Context | No | `"."` |
26+
| `registry` | Docker Registry | No | `"docker.io"` |
27+
| `push` | Push Docker Image to Registry | No | `false` |
28+
| `security-scan` | Enable Trivy Security Scan | No | `true` |
29+
| `security-report` | Security Report Mode (`"sarif"` \| `"comment"`; ignored if `security-scan: false`) | No | `"sarif"` |
30+
| `hadolint` | Enable Hadolint | No | `true` |
2431

2532
## 🔐 Secrets
2633

27-
| Name | Description | Required |
28-
| -------------------- | ---------------------------------------------------------------------------------- | -------- |
29-
| `dockerhub_username` | Username for Docker Hub authentication | Yes |
30-
| `dockerhub_pat` | Personal Access Token for Docker Hub authentication (with appropriate permissions) | Yes |
34+
| Name | Description | Required |
35+
| ---------- | --------------------------------------------------------------------------------------------------- | -------- |
36+
| `username` | Username for Docker Registry authentication | Yes |
37+
| `password` | Password or Personal Access Token for Docker registry authentication (with appropriate permissions) | Yes |
3138

3239
## 💻 Example Usage
3340

@@ -45,51 +52,18 @@ jobs:
4552
build:
4653
runs-on: ubuntu-latest
4754
steps:
48-
- uses: actions/checkout@v3
55+
- uses: actions/checkout@v4
4956
with:
5057
fetch-depth: 0 # Fetch all history for proper versioning
5158

5259
- name: Build and Push Docker Image
53-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@docker-build-v2.2.0
60+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@main # ⚠️ use tagged version here
5461
with:
5562
image-name: "username/my-image"
5663
dockerfile: "Dockerfile"
5764
secrets:
58-
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
59-
dockerhub_pat: ${{ secrets.DOCKERHUB_PAT }}
60-
```
61-
62-
## 🔍 Advanced Usage
63-
64-
### Multi-Platform Build Example
65-
66-
```yaml
67-
name: Build Multi-Platform Docker Image
68-
69-
on:
70-
release:
71-
types: [published]
72-
73-
jobs:
74-
build:
75-
runs-on: ubuntu-latest
76-
steps:
77-
- uses: actions/checkout@v3
78-
79-
- name: Set up QEMU
80-
uses: docker/setup-qemu-action@v2
81-
82-
- name: Set up Docker Buildx
83-
uses: docker/setup-buildx-action@v2
84-
85-
- name: Build and Push Docker Image
86-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
87-
with:
88-
dockerfile: "Dockerfile"
89-
tag: "myorg/myapp:${{ github.event.release.tag_name }}"
90-
secrets:
91-
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
92-
dockerhub_pat: ${{ secrets.DOCKERHUB_PAT }}
65+
username: ${{ secrets.DOCKERHUB_USERNAME }}
66+
password: ${{ secrets.DOCKERHUB_PAT }}
9367
```
9468
9569
## 📝 Notes

0 commit comments

Comments
 (0)