Created
September 11, 2019 22:10
-
-
Save czende/5c32069d06f0e1c85d1b44f2827971ae to your computer and use it in GitHub Desktop.
GitLab with runner via docker-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
gitlab-web: | |
image: gitlab/gitlab-ce:latest | |
container_name: gitlab-web | |
hostname: gitlab-web | |
volumes: | |
- './gitlab-config:/etc/gitlab' | |
- './gitlab-logs:/var/log/gitlab' | |
- './gitlab-data:/var/opt/gitlab' | |
ports: | |
- '2222:22' | |
- '81:80' | |
- '443:443' | |
- '4567:4567' | |
environment: | |
GITLAB_OMNIBUS_CONFIG: | | |
gitlab_rails['gitlab_shell_ssh_port'] = 2222 | |
registry_external_url 'http://localhost:4567' | |
registry['enable'] = true | |
unicorn['socket'] = '/opt/gitlab/var/unicorn/gitlab.socket' | |
networks: | |
- gitlab-network | |
gitlab-runners: | |
image: gitlab/gitlab-runner:latest | |
container_name: gitlab-runners | |
hostname: gitlab-runners | |
volumes: | |
- './gitlab-runners-config:/etc/gitlab-runner:Z' | |
- '/var/run/docker.sock:/var/run/docker.sock' | |
networks: | |
- gitlab-network | |
networks: | |
gitlab-network: | |
name: gitlab-network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Get the registration token from: | |
# http://localhost:81/admin/runners | |
registration_token=XXXXXXXXXXXXXXX | |
docker exec -it gitlab-runners \ | |
gitlab-runner register \ | |
--non-interactive \ | |
--registration-token ${registration_token} \ | |
--locked=false \ | |
--description docker-stable \ | |
--url http://gitlab-web \ | |
--executor docker \ | |
--docker-image docker:stable \ | |
--docker-volumes "/var/run/docker.sock:/var/run/docker.sock" \ | |
--docker-network-mode gitlab-network \ | |
--docker-privileged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment