52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
# linux-base
|
|
|
|
The container image our Gitea Actions runners use for basic tasks.
|
|
|
|
## Build
|
|
|
|
Build the image on your own machine and push it to Gitea's container registry.
|
|
The runners only ever pull it.
|
|
|
|
You will need an access token with `package:write` access.
|
|
Go to your Gitea settings and under “Applications,” you will find “Generate New Token.”
|
|
Give the token a name like `linux-base-package` and select “Read and Write” for package permissions.
|
|
Next, we will authenticate Docker for pushing packages by running `docker login` and using the newly generated token as the password.
|
|
|
|
```bash
|
|
docker login git.scient.ing
|
|
```
|
|
|
|
Now we can build the package for our servers, which are `linux/amd64`.
|
|
Note that Apple Silicon defaults to `arm64`, and an `arm64` image may push but then fail to start on the runner with an exec-format error.
|
|
|
|
`buildx` cross-compiles for the platform you specify; `--push` sends the result straight to the registry, so the build and upload are one step, and the trailing `.` is the build context (the directory containing this `Dockerfile`).
|
|
|
|
```bash
|
|
docker buildx build --platform linux/amd64 \
|
|
-t git.scient.ing/infra/linux-base:26.10.7 --push .
|
|
```
|
|
|
|
Bump the tag whenever the `Dockerfile` changes or with a revision suffix like `:26.10.7-2` otherwise.
|
|
The image is always pulled by an explicit version, never `latest`, so a runner's behavior stays tied to a named artifact you can roll back to.
|
|
|
|
## Use
|
|
|
|
A runner advertises a label that maps to this image, and a workflow selects it with `runs-on`.
|
|
|
|
```yaml
|
|
# in a runner's config.yaml
|
|
runner:
|
|
labels:
|
|
- "linux-base:docker://git.scient.ing/infra/linux-base:26.10.7"
|
|
```
|
|
|
|
```yaml
|
|
# in a site repository's .gitea/workflows/deploy.yml
|
|
jobs:
|
|
deploy:
|
|
runs-on: linux-base
|
|
```
|
|
|
|
Changing the image for each runner involves pointing the label at a new tag and restarting the runner.
|
|
The workflows never change.
|