generated from oci/template
Add readme with documentation
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 8s
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 8s
Be warned, majority was made with AI, manually edited for acuracy and consistency
This commit is contained in:
parent
bd6aebbc8c
commit
95a86b62ef
1 changed files with 39 additions and 21 deletions
60
Readme.md
60
Readme.md
|
@ -1,36 +1,54 @@
|
|||
# README for Docker Image Build and Publish Workflows
|
||||
# Forgejo Runner
|
||||
|
||||
## Overview
|
||||
The entrypoint script sets up and runs the `forgejo-runner`, including configuring the runner file and managing the registration process. The script supports custom configurations for Forgejo, Docker, and environment variables.
|
||||
|
||||
This repository contains two GitHub Actions workflows that automate the building and publishing of Docker images to an OCI registry.
|
||||
It is important to note that using the `command` docker flag will override the entrypoint *by design*, this is to make it compatible with older manual configurations
|
||||
|
||||
### Workflows
|
||||
## Environment Variables
|
||||
|
||||
1. **On Commit to Main**
|
||||
- **Trigger:** Activates on commits to the `main` branch (tags are excluded).
|
||||
- **Purpose:** Builds and publishes a Docker image for each commit.
|
||||
### Required Variables
|
||||
|
||||
2. **On Tag Push**
|
||||
- **Trigger:** Activates when a new tag is pushed.
|
||||
- **Purpose:** Builds and publishes a Docker image for the tag and tags it as `latest`.
|
||||
> Only needed during registration of the runner.
|
||||
> After initial registration the runner operates off of the runner.
|
||||
- **`FORGEJO_URL`**: The URL of the Forgejo instance. Default: `http://forgejo:3000` Only needed during registration of the runner.
|
||||
- **`FORGEJO_SECRET`**: Secret used for Forgejo runner creation. Only needed during registration of the runner.
|
||||
- **`RUNNER_TOKEN`**: Token used for runner registration. Only needed during registration of the runner.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Secrets Needed:**
|
||||
- `OCI_TOKEN`: Your OCI registry token.
|
||||
- `OCI_USER`: Your OCI registry username.
|
||||
- **`RUNNER_NAME`** (Optional): Name for the runner. Default: The hostname of the container.
|
||||
|
||||
## How to Use
|
||||
### Optional Configuration Variables
|
||||
- **`DEBUG`**: Enables debug logging. Default: `false`
|
||||
|
||||
1. **Clone the Repository:** Get a local copy of this repository.
|
||||
2. **Modify Dockerfile:** Update the `Dockerfile` for your application.
|
||||
3. **Push Changes:** Push changes to the `main` branch or create a new tag.
|
||||
4. **Check Workflow Status:** View the Actions tab in Forgjo to monitor workflow runs.
|
||||
- **`RUNNER_FILE`**: Path to the runner file. Default: `runner.json`
|
||||
- **`CONFIG_FILE`**: Path to the configuration file. Default: `/data/config.yml`
|
||||
- **`ENV_FILE`**: Path to the environment file. Default: `/data/.env`
|
||||
- **`RUNNER_LABELS`**: Labels to attach to the runner. Default:
|
||||
- `docker:docker://code.forgejo.org/oci/node:20-bookworm`
|
||||
- `ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04`
|
||||
|
||||
- **`DOCKER_HOST`**: Docker host URL. Default: `tcp://docker:2367`
|
||||
- **`DOCKER_CERT_PATH`**: Path to Docker certificates. Default: `/certs/client`
|
||||
- **`DOCKER_TLS_VERIFY`**: Whether Docker TLS verification is enabled. Default: `1`
|
||||
- **`DOCKER_PRIVILEGED`**: Whether to run the container in privileged mode. Default: `false`
|
||||
|
||||
|
||||
|
||||
- **`MAX_REG_ATTEMPTS`**: Maximum number of registration attempts. Default: `10`
|
||||
- **`SKIP_WAIT`**: Whether to skip the wait before starting the runner. Default: `false`
|
||||
|
||||
## Notes
|
||||
|
||||
- Ensure your Docker environment is compatible with multi-platform builds if necessary.
|
||||
- The entrypoint will automatically create and configure a `config.yml` file if it does not already exist.
|
||||
- The runner will attempt to connect to the Forgejo instance and register the runner automatically.
|
||||
- If `FORGEJO_SECRET` is not provided, the runner will use the `RUNNER_TOKEN` for registration.
|
||||
- If the registration fails, the script will retry according to the `MAX_REG_ATTEMPTS` value.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Invalid Configuration**: If the runner does not start, ensure that all required environment variables are set and that the configuration file is valid.
|
||||
- **Network Issues**: Check your `DOCKER_HOST` and `DOCKER_CERT_PATH` to ensure that Docker is properly configured for secure communication.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
||||
This image is distributed under the MIT license. See the LICENSE file for more details.
|
Loading…
Reference in a new issue