@@ -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