pass tests, allow drop in replacement

restore original variables
update to include privileged variable
treat `command` as a command and not an argument to entrypoint
This commit is contained in:
Merith 2024-09-27 10:46:35 -07:00 committed by Merith-TK
parent 27bbc83fed
commit 38a43e67ed
3 changed files with 38 additions and 25 deletions

View file

@ -13,11 +13,8 @@
#
# Replace ${RUNNER_TOKEN} with the token obtained from the Forgejo web interface.
#
# Replace ROOT_PASSWORD with a secure password.
# Replace {ROOT_PASSWORD} with a secure password.
#
networks:
forgejo:
volumes:
docker_certs:
@ -27,8 +24,6 @@ services:
hostname: docker # Must set hostname for both internal DNS and TLS to work as certs are only valid for docker and localhost
restart: unless-stopped
privileged: true
networks:
- forgejo
environment:
DOCKER_TLS_CERTDIR: "/certs" # set to "" to disable the use of TLS, also manually update existing runner configs to use port 2375
DOCKER_HOST: "docker" # remove aswell to disable TLS
@ -38,19 +33,22 @@ services:
forgejo:
image: codeberg.org/forgejo/forgejo:1.21
hostname: forgejo
networks:
- forgejo
volumes:
- /srv/forgejo-data:/data
ports:
- 8080:3000
environment:
FORGEJO__security__INSTALL_LOCK: "true" # remove in production
FORGEJO__log__LEVEL: "debug" # remove in production
FORGEJO__repository__ENABLE_PUSH_CREATE_USER: "true" # enables the ability to create a repo when pushing
FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE: "false" # defaults above to public
FORGEJO__repository__DEFAULT_REPO_UNITS: "repo.code,repo.actions"
# `command` is not neecessary, but can be used to create an admin user as shown below when combined with INSTALL_LOCK
command: >-
bash -c '
/bin/s6-svscan /etc/s6 &
sleep 10 ;
su -c "forgejo admin user create --admin --username root --password ROOT_PASSWORD --email root@example.com" git ;
su -c "forgejo admin user create --admin --username root --password {ROOT_PASSWORD} --email root@example.com" git ;
su -c "forgejo forgejo-cli actions register --secret {SHARED_SECRET}" git ;
sleep infinity
'
@ -69,17 +67,19 @@ services:
volumes:
- /srv/runner-data:/data
- docker_certs:/certs
networks:
- forgejo
depends_on:
- docker-in-docker
- forgejo
links:
- forgejo
- docker-in-docker
environment:
CONFIG_FILE: config.yml # defaults to /data/config.yml
DOCKER_HOST: "tcp://docker:2376" # defaults to tcp://docker:2376
DOCKER_CERT_PATH: "/certs/client" # defaults to /certs/client
DOCKER_TLS_VERIFY: "1" # defaults to 1
DOCKER_PRIVILEGED: "true" # defaults to false for security reasons
FORGEJO_URL: ${FORGEJO_URL} # defaults to http://forgejo:3000
FORGEJO_SECRET: "{SHARED_SECRET}" # shared secret, must match Forgejo's, overrides RUNNER_TOKEN