Archived
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: olixero-ci-agent
|
|
|
|
x-runner-common: &runner-common
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: ${CI_AGENT_IMAGE:-olixero-ci-agent-runner:1.0.0}
|
|
user: "10001:10001"
|
|
environment:
|
|
HOME: /home/ci-agent
|
|
XDG_DATA_HOME: /var/lib/opencode-ci/data
|
|
XDG_CONFIG_HOME: /opt/ci-agents/empty-config
|
|
XDG_CACHE_HOME: /var/lib/opencode-ci/cache
|
|
CONFIG_FILE: /etc/gitea-runner/config.yaml
|
|
volumes:
|
|
- ${RUNNER_DATA_DIR:-./state/runner}:/data
|
|
- ${OPENCODE_DATA_DIR:-./state/opencode}:/var/lib/opencode-ci/data
|
|
- ${CACHE_DIR:-./state/cache}:/var/lib/opencode-ci/cache
|
|
- ./runner-config.yaml:/etc/gitea-runner/config.yaml:ro
|
|
tmpfs:
|
|
- /tmp:rw,nosuid,nodev,mode=1777
|
|
|
|
services:
|
|
runner:
|
|
<<: *runner-common
|
|
restart: unless-stopped
|
|
read_only: true
|
|
stop_grace_period: 2m
|
|
|
|
register:
|
|
<<: *runner-common
|
|
profiles: ["register"]
|
|
restart: "no"
|
|
user: "0:0"
|
|
read_only: true
|
|
entrypoint: ["/bin/sh", "-ec"]
|
|
command:
|
|
- |
|
|
test ! -s /data/.runner || { echo 'Runner is already registered.'; exit 1; }
|
|
token="$$(cat /run/secrets/runner_registration_token)"
|
|
gitea-runner register --no-interactive \
|
|
--config /etc/gitea-runner/config.yaml \
|
|
--instance "$${GITEA_INSTANCE_URL}" \
|
|
--token "$${token}" \
|
|
--name "$${GITEA_RUNNER_NAME}" \
|
|
--labels "agentic:host"
|
|
unset token
|
|
chown 10001:10001 /data/.runner
|
|
chmod 0600 /data/.runner
|
|
environment:
|
|
HOME: /home/ci-agent
|
|
XDG_DATA_HOME: /var/lib/opencode-ci/data
|
|
XDG_CONFIG_HOME: /opt/ci-agents/empty-config
|
|
XDG_CACHE_HOME: /var/lib/opencode-ci/cache
|
|
GITEA_INSTANCE_URL: ${GITEA_INSTANCE_URL:?Set GITEA_INSTANCE_URL in .env}
|
|
GITEA_RUNNER_NAME: ${GITEA_RUNNER_NAME:-olixero-agentic}
|
|
secrets:
|
|
- runner_registration_token
|
|
|
|
secrets:
|
|
runner_registration_token:
|
|
file: ${RUNNER_TOKEN_FILE:-./secrets/runner-token}
|