act-base/README.md
2026-04-07 00:59:57 +00:00

53 lines
2.0 KiB
Markdown
Executable File

# Container Build and Publish Template
This repository provides a basic template for building and publishing container images using Gitea Actions.
## Environment Variables
The following environment variables are expected to be set in the `.env` file for local development, and as Gitea repository or organization variables for CI/CD:
* `REG`: The container registry hostname (e.g., `zima1.abutili.net:3002`)
* `NS`: The namespace/project within the registry (e.g., `devops`)
* `IMG`: The image name (e.g., `container-build-publish`)
Example `.env` file:
```
REG=zima1.abutili.net:3002
NS=devops
IMG=container-build-publish
```
## Gitea Secrets
The Gitea workflow requires the following secrets to be configured in your Gitea repository or organization:
* `REGISTRY_USER`: Username for logging into the container registry.
* `REGISTRY_PASSWORD`: Password for logging into the container registry.
## Local Development with `just`
This project uses `just` for local task automation.
### Installation
If you don't have `just` installed, you can find installation instructions [here](https://github.com/casey/just#installation).
### Available Commands
* `just build`: Builds the Docker image with a tag based on the current Git tag or branch/short SHA.
* `just build-latest`: Builds the Docker image with the `:latest` tag.
* `just run`: Runs the locally built Docker image.
* `just clean`: Removes locally built Docker images for this project.
* `just print-env`: Displays the computed `REPO` and `TAG` variables.
## Gitea Workflow (`.gitea/workflows/build-publish.yml`)
This workflow is triggered on pushes to the `main` branch, tags, and pull requests.
* It logs into the specified container registry using `REGISTRY_USER` and `REGISTRY_PASSWORD` secrets.
* It builds the Docker image and pushes it to the registry.
* For pushes to `main` and tags, it pushes the image with a tag derived from the Git ref.
* For pushes to `main`, it also tags and pushes the image with `:latest`.
* Pull requests will build the image but not push it.