Base container image for use with Actions
https://github.com/nektos/act
| .gitea/workflows | ||
| .dockerignore | ||
| .env | ||
| .gitignore | ||
| .justfile | ||
| .tool-versions | ||
| Dockerfile | ||
| README.md | ||
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.
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:latesttag.just run: Runs the locally built Docker image.just clean: Removes locally built Docker images for this project.just print-env: Displays the computedREPOandTAGvariables.
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_USERandREGISTRY_PASSWORDsecrets. - It builds the Docker image and pushes it to the registry.
- For pushes to
mainand 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.