added readme
All checks were successful
/ test_build_docker (push) Successful in 10s
/ test_build_go (push) Successful in 8s

This commit is contained in:
Kai Reichart 2024-11-28 10:17:43 +01:00
parent 9201d5924b
commit 5c253ef293
4 changed files with 60 additions and 15 deletions

View file

@ -1,4 +1,4 @@
name: Build Docker Container name: Build Go Binary
on: on:
workflow_call: workflow_call:

View file

@ -1,17 +1,6 @@
# Pipeline Component - Build # Pipeline Component - Build
This component is responsible for building software artifacts. This repository contains pipeline components for building software. Currently, it includes the following components:
## Inputs - [Build Go](./build-go.md)
- [Build and Push Docker](./build-and-push-docker.md)
| Name | Description | Default | Required |
|------|-------------|---------|:--------:|
| source | The source directory to build | `./` | false |
| target | The target directory to store the build artifacts | `./dist` | false |
## Usage
```yaml
```

31
build-and-push-docker.md Normal file
View file

@ -0,0 +1,31 @@
# 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:
uses: [path/to/this-action@main](https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/build/.github/workflows/build-docker.yml@main)
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 }}
```

25
build-go.md Normal file
View file

@ -0,0 +1,25 @@
# Build Go Forgejo Action
This Action builds a Go application. It compiles the specified Go source file and outputs the build artifacts to a target directory.
## Inputs
| Input Name | Description | Required | Type | Default Value |
|-------------|-------------------------------------|----------|--------|-------------------------|
| `source` | The path to the Go source file to build. | No | string | `./main.go` |
| `target` | The output path for build artifacts. | No | string | `./dist/main` |
| `go-version`| The Go version to use. | No | string | `>=1.23` |
## Usage
This action can be called from other workflows using `workflow_call`. Below is an example of how to invoke it:
```yaml
jobs:
build:
uses: https://forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/DevFW-CICD/build/.github/workflows/build-go.yml@main
with:
source: './cmd/app/main.go'
target: './build/app'
go-version: '1.19'
```