Merge pull request #2722 from DarkGhostHunter/feat-forgejo
Feat: Forgejo templates
This commit is contained in:
		
							
								
								
									
										1
									
								
								public/svgs/forgejo.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								public/svgs/forgejo.svg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 212 212" width="32" height="32"><style>circle,path{fill:none;stroke:#000;stroke-width:15}path{stroke-width:25}.orange{stroke:#f60}.red{stroke:#d40000}</style><g transform="translate(6 6)"><path d="M58 168V70a50 50 0 0 1 50-50h20" class="orange"/><path d="M58 168v-30a50 50 0 0 1 50-50h20" class="red"/><circle cx="142" cy="20" r="18" class="orange"/><circle cx="142" cy="88" r="18" class="red"/><circle cx="58" cy="180" r="18" class="red"/></g></svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 503 B  | 
							
								
								
									
										49
									
								
								templates/compose/forgejo-with-mariadb.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								templates/compose/forgejo-with-mariadb.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, mariadb
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - FORGEJO__database__DB_TYPE=mysql
 | 
				
			||||||
 | 
					      - FORGEJO__database__HOST=mariadb
 | 
				
			||||||
 | 
					      - FORGEJO__database__NAME=${MYSQL_DATABASE-forgejo}
 | 
				
			||||||
 | 
					      - FORGEJO__database__USER=$SERVICE_USER_MYSQL
 | 
				
			||||||
 | 
					      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_MYSQL
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      mariadb:
 | 
				
			||||||
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mariadb:
 | 
				
			||||||
 | 
					    image: mariadb:11
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-mariadb-data:/var/lib/mysql
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - MYSQL_USER=${SERVICE_USER_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_DATABASE=${MYSQL_DATABASE}
 | 
				
			||||||
 | 
					      - MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 20s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
							
								
								
									
										49
									
								
								templates/compose/forgejo-with-mysql.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								templates/compose/forgejo-with-mysql.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, mysql
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - FORGEJO__database__DB_TYPE=mysql
 | 
				
			||||||
 | 
					      - FORGEJO__database__HOST=mysql
 | 
				
			||||||
 | 
					      - FORGEJO__database__NAME=${MYSQL_DATABASE-forgejo}
 | 
				
			||||||
 | 
					      - FORGEJO__database__USER=$SERVICE_USER_MYSQL
 | 
				
			||||||
 | 
					      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_MYSQL
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      mysql:
 | 
				
			||||||
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mysql:
 | 
				
			||||||
 | 
					    image: mysql:8
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-mysql-data:/var/lib/mysql
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - MYSQL_USER=${SERVICE_USER_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_DATABASE=${MYSQL_DATABASE}
 | 
				
			||||||
 | 
					      - MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"]
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 20s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
							
								
								
									
										48
									
								
								templates/compose/forgejo-with-postgresql.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								templates/compose/forgejo-with-postgresql.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, postgresql
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - FORGEJO__database__DB_TYPE=postgres
 | 
				
			||||||
 | 
					      - FORGEJO__database__HOST=postgresql
 | 
				
			||||||
 | 
					      - FORGEJO__database__NAME=${POSTGRESQL_DATABASE-forgejo}
 | 
				
			||||||
 | 
					      - FORGEJO__database__USER=$SERVICE_USER_POSTGRESQL
 | 
				
			||||||
 | 
					      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_POSTGRESQL
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      postgresql:
 | 
				
			||||||
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  postgresql:
 | 
				
			||||||
 | 
					    image: postgres:16-alpine
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-postgresql-data:/var/lib/postgresql/data
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
 | 
				
			||||||
 | 
					      - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
 | 
				
			||||||
 | 
					      - POSTGRES_DB=${POSTGRESQL_DATABASE}
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 20s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
							
								
								
									
										137
									
								
								templates/compose/forgejo-with-runner-with-mariadb.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								templates/compose/forgejo-with-runner-with-mariadb.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,137 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, runner, mariadb, actions, cicd, ci
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - FORGEJO__database__DB_TYPE=mysql
 | 
				
			||||||
 | 
					      - FORGEJO__database__HOST=mariadb
 | 
				
			||||||
 | 
					      - FORGEJO__database__NAME=${MYSQL_DATABASE-forgejo}
 | 
				
			||||||
 | 
					      - FORGEJO__database__USER=$SERVICE_USER_MYSQL
 | 
				
			||||||
 | 
					      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_MYSQL
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET-0000000000000000000000000000000000000000}
 | 
				
			||||||
 | 
					      - FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE=false
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.actions
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      mariadb:
 | 
				
			||||||
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      /bin/s6-svscan /etc/s6 &
 | 
				
			||||||
 | 
					      sleep 10 ;
 | 
				
			||||||
 | 
					      su -c "forgejo forgejo-cli actions register --secret ${RUNNER_SHARED_SECRET}" git ;
 | 
				
			||||||
 | 
					      sleep infinity
 | 
				
			||||||
 | 
					      ' 
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  mariadb:
 | 
				
			||||||
 | 
					    image: mariadb:11
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-mariadb-data:/var/lib/mysql
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - MYSQL_USER=${SERVICE_USER_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_DATABASE=${MYSQL_DATABASE}
 | 
				
			||||||
 | 
					      - MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 20s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  docker-in-docker:
 | 
				
			||||||
 | 
					    image: docker:dind
 | 
				
			||||||
 | 
					    hostname: docker
 | 
				
			||||||
 | 
					    privileged: true
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "dockerd"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      DOCKER_TLS_CERTDIR: /certs
 | 
				
			||||||
 | 
					      DOCKER_HOST: docker-in-docker
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  runner-register:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    restart: 'no'
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker-in-docker:2376
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET}
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      disable: true
 | 
				
			||||||
 | 
					    user: 0:0
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -ec '
 | 
				
			||||||
 | 
					      while : ; do
 | 
				
			||||||
 | 
					        forgejo-runner create-runner-file --connect --instance http://forgejo:3000 --name runner --secret ${RUNNER_SHARED_SECRET} && break ;
 | 
				
			||||||
 | 
					        sleep 1 ;
 | 
				
			||||||
 | 
					      done ;
 | 
				
			||||||
 | 
					      sed -i -e "s|\"labels\": null|\"labels\": [\"docker:docker://node:20-bookworm\", \"ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04\"]|" .runner ;
 | 
				
			||||||
 | 
					      forgejo-runner generate-config > config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|network: .*|network: host|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  envs:$$|  envs:\n    DOCKER_HOST: tcp://docker:2376\n    DOCKER_TLS_VERIFY: 1\n    DOCKER_CERT_PATH: /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  options:|  options: -v /certs/client:/certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|  valid_volumes: \[\]$$|  valid_volumes:\n    - /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      chown -R 1000:1000 /data ;
 | 
				
			||||||
 | 
					      exit 0
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  runner:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      docker-in-docker:
 | 
				
			||||||
 | 
					        condition: service_started
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker:2376
 | 
				
			||||||
 | 
					      - DOCKER_CERT_PATH=/certs/client
 | 
				
			||||||
 | 
					      - DOCKER_TLS_VERIFY=1
 | 
				
			||||||
 | 
					    user: 1000:1000
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "forgejo-runner"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      while : ; do test -w .runner && forgejo-runner --config config.yml daemon ; sleep 1 ; done
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
							
								
								
									
										137
									
								
								templates/compose/forgejo-with-runner-with-mysql.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								templates/compose/forgejo-with-runner-with-mysql.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,137 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, runner, mysql, actions, cicd, ci
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - FORGEJO__database__DB_TYPE=mysql
 | 
				
			||||||
 | 
					      - FORGEJO__database__HOST=mysql
 | 
				
			||||||
 | 
					      - FORGEJO__database__NAME=${MYSQL_DATABASE-forgejo}
 | 
				
			||||||
 | 
					      - FORGEJO__database__USER=$SERVICE_USER_MYSQL
 | 
				
			||||||
 | 
					      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_MYSQL
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET-0000000000000000000000000000000000000000}
 | 
				
			||||||
 | 
					      - FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE=false
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.actions
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      mysql:
 | 
				
			||||||
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      /bin/s6-svscan /etc/s6 &
 | 
				
			||||||
 | 
					      sleep 10 ;
 | 
				
			||||||
 | 
					      su -c "forgejo forgejo-cli actions register --secret ${RUNNER_SHARED_SECRET}" git ;
 | 
				
			||||||
 | 
					      sleep infinity
 | 
				
			||||||
 | 
					      ' 
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  mysql:
 | 
				
			||||||
 | 
					    image: mysql:8
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-mysql-data:/var/lib/mysql
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - MYSQL_USER=${SERVICE_USER_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_PASSWORD=${SERVICE_PASSWORD_MYSQL}
 | 
				
			||||||
 | 
					      - MYSQL_DATABASE=${MYSQL_DATABASE}
 | 
				
			||||||
 | 
					      - MYSQL_ROOT_PASSWORD=${SERVICE_PASSWORD_MYSQLROOT}
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"]
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 20s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  docker-in-docker:
 | 
				
			||||||
 | 
					    image: docker:dind
 | 
				
			||||||
 | 
					    hostname: docker
 | 
				
			||||||
 | 
					    privileged: true
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "dockerd"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      DOCKER_TLS_CERTDIR: /certs
 | 
				
			||||||
 | 
					      DOCKER_HOST: docker-in-docker
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  runner-register:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    restart: 'no'
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker-in-docker:2376
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET}
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      disable: true
 | 
				
			||||||
 | 
					    user: 0:0
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -ec '
 | 
				
			||||||
 | 
					      while : ; do
 | 
				
			||||||
 | 
					        forgejo-runner create-runner-file --connect --instance http://forgejo:3000 --name runner --secret ${RUNNER_SHARED_SECRET} && break ;
 | 
				
			||||||
 | 
					        sleep 1 ;
 | 
				
			||||||
 | 
					      done ;
 | 
				
			||||||
 | 
					      sed -i -e "s|\"labels\": null|\"labels\": [\"docker:docker://node:20-bookworm\", \"ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04\"]|" .runner ;
 | 
				
			||||||
 | 
					      forgejo-runner generate-config > config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|network: .*|network: host|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  envs:$$|  envs:\n    DOCKER_HOST: tcp://docker:2376\n    DOCKER_TLS_VERIFY: 1\n    DOCKER_CERT_PATH: /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  options:|  options: -v /certs/client:/certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|  valid_volumes: \[\]$$|  valid_volumes:\n    - /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      chown -R 1000:1000 /data ;
 | 
				
			||||||
 | 
					      exit 0
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  runner:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      docker-in-docker:
 | 
				
			||||||
 | 
					        condition: service_started
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker:2376
 | 
				
			||||||
 | 
					      - DOCKER_CERT_PATH=/certs/client
 | 
				
			||||||
 | 
					      - DOCKER_TLS_VERIFY=1
 | 
				
			||||||
 | 
					    user: 1000:1000
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "forgejo-runner"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      while : ; do test -w .runner && forgejo-runner --config config.yml daemon ; sleep 1 ; done
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
							
								
								
									
										136
									
								
								templates/compose/forgejo-with-runner-with-postgresql.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								templates/compose/forgejo-with-runner-with-postgresql.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, runner, postresql, actions, cicd, ci
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - FORGEJO__database__DB_TYPE=postgres
 | 
				
			||||||
 | 
					      - FORGEJO__database__HOST=postgresql
 | 
				
			||||||
 | 
					      - FORGEJO__database__NAME=${POSTGRESQL_DATABASE-forgejo}
 | 
				
			||||||
 | 
					      - FORGEJO__database__USER=$SERVICE_USER_POSTGRESQL
 | 
				
			||||||
 | 
					      - FORGEJO__database__PASSWD=$SERVICE_PASSWORD_POSTGRESQL
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET-0000000000000000000000000000000000000000}
 | 
				
			||||||
 | 
					      - FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE=false
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.actions
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      postgresql:
 | 
				
			||||||
 | 
					        condition: service_healthy
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      /bin/s6-svscan /etc/s6 &
 | 
				
			||||||
 | 
					      sleep 10 ;
 | 
				
			||||||
 | 
					      su -c "forgejo forgejo-cli actions register --secret ${RUNNER_SHARED_SECRET}" git ;
 | 
				
			||||||
 | 
					      sleep infinity
 | 
				
			||||||
 | 
					      ' 
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  postgresql:
 | 
				
			||||||
 | 
					    image: postgres:16-alpine
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-postgresql-data:/var/lib/postgresql/data
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
 | 
				
			||||||
 | 
					      - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
 | 
				
			||||||
 | 
					      - POSTGRES_DB=${POSTGRESQL_DATABASE}
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
 | 
				
			||||||
 | 
					      interval: 5s
 | 
				
			||||||
 | 
					      timeout: 20s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  docker-in-docker:
 | 
				
			||||||
 | 
					    image: docker:dind
 | 
				
			||||||
 | 
					    hostname: docker
 | 
				
			||||||
 | 
					    privileged: true
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "dockerd"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      DOCKER_TLS_CERTDIR: /certs
 | 
				
			||||||
 | 
					      DOCKER_HOST: docker-in-docker
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  runner-register:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    restart: 'no'
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker-in-docker:2376
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET}
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      disable: true
 | 
				
			||||||
 | 
					    user: 0:0
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -ec '
 | 
				
			||||||
 | 
					      while : ; do
 | 
				
			||||||
 | 
					        forgejo-runner create-runner-file --connect --instance http://forgejo:3000 --name runner --secret ${RUNNER_SHARED_SECRET} && break ;
 | 
				
			||||||
 | 
					        sleep 1 ;
 | 
				
			||||||
 | 
					      done ;
 | 
				
			||||||
 | 
					      sed -i -e "s|\"labels\": null|\"labels\": [\"docker:docker://node:20-bookworm\", \"ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04\"]|" .runner ;
 | 
				
			||||||
 | 
					      forgejo-runner generate-config > config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|network: .*|network: host|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  envs:$$|  envs:\n    DOCKER_HOST: tcp://docker:2376\n    DOCKER_TLS_VERIFY: 1\n    DOCKER_CERT_PATH: /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  options:|  options: -v /certs/client:/certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|  valid_volumes: \[\]$$|  valid_volumes:\n    - /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      chown -R 1000:1000 /data ;
 | 
				
			||||||
 | 
					      exit 0
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  runner:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      docker-in-docker:
 | 
				
			||||||
 | 
					        condition: service_started
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker:2376
 | 
				
			||||||
 | 
					      - DOCKER_CERT_PATH=/certs/client
 | 
				
			||||||
 | 
					      - DOCKER_TLS_VERIFY=1
 | 
				
			||||||
 | 
					    user: 1000:1000
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "forgejo-runner"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      while : ; do test -w .runner && forgejo-runner --config config.yml daemon ; sleep 1 ; done
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
							
								
								
									
										114
									
								
								templates/compose/forgejo-with-runner.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								templates/compose/forgejo-with-runner.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,114 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight, runner, actions, cicd, ci
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET-0000000000000000000000000000000000000000}
 | 
				
			||||||
 | 
					      - FORGEJO__repository__ENABLE_PUSH_CREATE_USER=true
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_PUSH_CREATE_PRIVATE=false
 | 
				
			||||||
 | 
					      - FORGEJO__repository__DEFAULT_REPO_UNITS=repo.code,repo.actions
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      /bin/s6-svscan /etc/s6 &
 | 
				
			||||||
 | 
					      sleep 10 ;
 | 
				
			||||||
 | 
					      su -c "forgejo forgejo-cli actions register --secret ${RUNNER_SHARED_SECRET}" git ;
 | 
				
			||||||
 | 
					      sleep infinity
 | 
				
			||||||
 | 
					      ' 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  docker-in-docker:
 | 
				
			||||||
 | 
					    image: docker:dind
 | 
				
			||||||
 | 
					    hostname: docker
 | 
				
			||||||
 | 
					    privileged: true
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "dockerd"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      DOCKER_TLS_CERTDIR: /certs
 | 
				
			||||||
 | 
					      DOCKER_HOST: docker-in-docker
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  runner-register:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    restart: 'no'
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker-in-docker:2376
 | 
				
			||||||
 | 
					      - RUNNER_SHARED_SECRET=${RUNNER_SHARED_SECRET}
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      disable: true
 | 
				
			||||||
 | 
					    user: 0:0
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -ec '
 | 
				
			||||||
 | 
					      while : ; do
 | 
				
			||||||
 | 
					        forgejo-runner create-runner-file --connect --instance http://forgejo:3000 --name runner --secret ${RUNNER_SHARED_SECRET} && break ;
 | 
				
			||||||
 | 
					        sleep 1 ;
 | 
				
			||||||
 | 
					      done ;
 | 
				
			||||||
 | 
					      sed -i -e "s|\"labels\": null|\"labels\": [\"docker:docker://node:20-bookworm\", \"ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04\"]|" .runner ;
 | 
				
			||||||
 | 
					      forgejo-runner generate-config > config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|network: .*|network: host|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  envs:$$|  envs:\n    DOCKER_HOST: tcp://docker:2376\n    DOCKER_TLS_VERIFY: 1\n    DOCKER_CERT_PATH: /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|^  options:|  options: -v /certs/client:/certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      sed -i -e "s|  valid_volumes: \[\]$$|  valid_volumes:\n    - /certs/client|" config.yml ;
 | 
				
			||||||
 | 
					      chown -R 1000:1000 /data ;
 | 
				
			||||||
 | 
					      exit 0
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  runner:
 | 
				
			||||||
 | 
					    image: code.forgejo.org/forgejo/runner:3.5.0
 | 
				
			||||||
 | 
					    links:
 | 
				
			||||||
 | 
					      - docker-in-docker
 | 
				
			||||||
 | 
					      - forgejo
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      docker-in-docker:
 | 
				
			||||||
 | 
					        condition: service_started
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - DOCKER_HOST=tcp://docker:2376
 | 
				
			||||||
 | 
					      - DOCKER_CERT_PATH=/certs/client
 | 
				
			||||||
 | 
					      - DOCKER_TLS_VERIFY=1
 | 
				
			||||||
 | 
					    user: 1000:1000
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-runner-data:/data
 | 
				
			||||||
 | 
					      - forgejo-did-certs:/certs
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    restart: 'unless-stopped'
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "pgrep", "forgejo-runner"]
 | 
				
			||||||
 | 
					      interval: 10s
 | 
				
			||||||
 | 
					      timeout: 30s
 | 
				
			||||||
 | 
					      retries: 10
 | 
				
			||||||
 | 
					    command: >-
 | 
				
			||||||
 | 
					      bash -c '
 | 
				
			||||||
 | 
					      while : ; do test -w .runner && forgejo-runner --config config.yml daemon ; sleep 1 ; done
 | 
				
			||||||
 | 
					      '
 | 
				
			||||||
							
								
								
									
										26
									
								
								templates/compose/forgejo.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								templates/compose/forgejo.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					# documentation: https://forgejo.org/docs
 | 
				
			||||||
 | 
					# slogan: Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.
 | 
				
			||||||
 | 
					# tags: version control, collaboration, code, hosting, lightweight
 | 
				
			||||||
 | 
					# logo: svgs/forgejo.svg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  forgejo:
 | 
				
			||||||
 | 
					    image: codeberg.org/forgejo/forgejo:7
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - SERVICE_FQDN_FORGEJO_3000
 | 
				
			||||||
 | 
					      - FORGEJO__server__ROOT_URL=${SERVICE_FQDN_FORGEJO}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOWED_DOMAINS=${FORGEJO__migrations__ALLOWED_DOMAINS}
 | 
				
			||||||
 | 
					      - FORGEJO__migrations__ALLOW_LOCALNETWORKS=${FORGEJO__migrations__ALLOW_LOCALNETWORKS-false}
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - 22222:22
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - forgejo-data:/data
 | 
				
			||||||
 | 
					      - forgejo-timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - forgejo-localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    healthcheck:
 | 
				
			||||||
 | 
					      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"]
 | 
				
			||||||
 | 
					      interval: 2s
 | 
				
			||||||
 | 
					      timeout: 10s
 | 
				
			||||||
 | 
					      retries: 15
 | 
				
			||||||
		Reference in New Issue
	
	Block a user