Add docker-build composite action
This commit is contained in:
55
README.md
55
README.md
@@ -1,3 +1,56 @@
|
||||
# actions-docker
|
||||
|
||||
Reusable Docker build+push action for Gitea Actions with buildx and layer caching
|
||||
Reusable Gitea Actions for Docker build + push workflows.
|
||||
|
||||
## actions/docker-build
|
||||
|
||||
Composite action that builds and optionally pushes Docker images with `docker buildx`.
|
||||
|
||||
### Usage
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Build and push
|
||||
uses: https://git.ericxliu.me/eric/actions-docker/.gitea/actions/docker-build@main
|
||||
with:
|
||||
image-name: registry.example.com/myimage
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
push: true
|
||||
cache-from: type=local,src=/tmp/buildx-cache
|
||||
cache-to: type=local,dest=/tmp/buildx-cache,mode=max
|
||||
```
|
||||
|
||||
### Inputs
|
||||
|
||||
| Input | Required | Default | Description |
|
||||
|-------|----------|---------|-------------|
|
||||
| `dockerfile` | No | `Dockerfile` | Path to Dockerfile relative to `context` |
|
||||
| `context` | No | `.` | Build context path |
|
||||
| `image-name` | **Yes** | — | Full image name (registry/image) |
|
||||
| `tags` | No | (none) | Extra tags as CSV |
|
||||
| `platforms` | No | `linux/amd64` | Platforms as CSV |
|
||||
| `push` | No | `false` | Push images after build |
|
||||
| `cache-from` | No | — | Cache source |
|
||||
| `cache-to` | No | `type=local,dest=/tmp/buildx-cache,mode=max` | Cache destination |
|
||||
| `build-args` | No | — | Build args as CSV `KEY=VALUE,KEY2=VALUE2` |
|
||||
|
||||
### Outputs
|
||||
|
||||
| Output | Description |
|
||||
|--------|-------------|
|
||||
| `image` | Full image name |
|
||||
| `tag` | Primary tag (date-SHA) |
|
||||
| `digest` | Image digest after push |
|
||||
|
||||
### Features
|
||||
|
||||
- **Multi-platform** builds via QEMU (if platforms != linux/amd64)
|
||||
- **Layer caching** via local buildx cache
|
||||
- **Git metadata** — auto-adds `date-SHA` tag + git tag if on a tag ref
|
||||
- **`DOCKER_HOST`** — auto-configured for Gitea Actions (`tcp://docker.local:2375`)
|
||||
|
||||
Reference in New Issue
Block a user