Skip to content

Instantly share code, notes, and snippets.

@beastycoding
Forked from benoitpetit/docker-compose.yml
Created July 12, 2024 05:36
Show Gist options
  • Save beastycoding/f51388476dd446e505d9de0a1e33a6b6 to your computer and use it in GitHub Desktop.
Save beastycoding/f51388476dd446e505d9de0a1e33a6b6 to your computer and use it in GitHub Desktop.
complete Gitlab installation and a runner with docker
version: '4.5'
services:
# GITLAB
gitlab-web:
image: 'gitlab/gitlab-ce:latest'
restart: always
container_name: gitlab-web
hostname: '192.168.0.14'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://192.168.0.14'
gitlab_rails['gitlab_shell_ssh_port'] = 2222
ports:
- "80:80"
- "443:443"
- "2222:22"
volumes:
- './gitlab/config:/etc/gitlab'
- './gitlab/logs:/var/log/gitlab'
- './gitlab/data:/var/opt/gitlab'
networks:
- gitlab-network
# RUNNER
gitlab-runner1:
image: gitlab/gitlab-runner:alpine
restart: always
container_name: gitlab-runner1
hostname: gitlab-runner1
depends_on:
- gitlab-web
volumes:
- ./config/gitlab-runner:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
networks:
- gitlab-network
networks:
gitlab-network:
name: gitlab-network
#!/bin/sh
###################################################################
# Récuperer le token d'enregistrement du runner via ce lien:
# http://localhost:8080/root/${project}/settings/ci_cd
# Benoit Petit: https://github.com/benoitpetit
###################################################################
# modifier avec votre token
registration_token=XXXXXXXXXXXXXXX
url=http://127.0.0.1
docker exec -it gitlab-runner1 \
gitlab-runner register \
--non-interactive \
--registration-token ${registration_token} \
--locked=false \
--description docker-stable \
--url ${url} \
--executor docker \
--docker-image docker:stable \
--docker-volumes "/var/run/docker.sock:/var/run/docker.sock" \
--docker-network-mode gitlab-network
# executer le script pour inscrire le runner dans Gitlab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment