build/build-and-push-docker.md

32 lines
1.4 KiB
Markdown
Raw Normal View History

2024-11-28 09:17:43 +00:00
# Build Docker Forgejo Action
This Action builds and pushes a Docker image using Kaniko. It supports custom Dockerfiles, build contexts, and private registry authentication.
## Inputs
| Input Name | Description | Required | Type | Default Value |
|-------------|-----------------------------------------------|----------|--------|-----------------|
| `dockerfile`| Path to the Dockerfile to be built. | No | string | `./Dockerfile` |
| `context` | Build context directory. | No | string | `./` |
| `tag` | Tag to apply to the built image. | Yes | string | |
| `registry` | Registry to push the image to. | Yes | string | |
| `username` | Username for registry authentication. | Yes | string | |
| `password` | Password for registry authentication. | Yes | string | |
## Usage
This action can be invoked using `workflow_call`. Below is an example of how to use it:
```yaml
jobs:
build:
2024-11-28 13:10:23 +00:00
uses: DevFW-CICD/build/.github/workflows/build-docker.yml@main
2024-11-28 09:17:43 +00:00
with:
dockerfile: './Dockerfile.custom'
context: './app'
tag: 'my-registry.com/my-app:latest'
registry: 'my-registry.com'
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
```