配置过程如下
下载gitlab镜像
docker pull gitlab/gitlab-ce:latest
docker-compose.yml
web: image: 'gitlab/gitlab-ce:latest' container_name: 'gitlab' # restart: always environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://192.168.0.24' gitlab_rails['gitlab_shell_ssh_port'] = 2332 ports: - '80:80' - '443:443' - '2332:22' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlab'
运行
export GITLAB_HOME=/home/`whoami`/downloads/gitlab
docker-compose up -d
查看root密码
docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
持续集成
需要安装runner
可以用docker和原生模式安装
正式用的时候,建议使用原生模式
docker模式安装
export GITLAB_RUNNER_HOME=/home/`whoami`/downloads/gitlab-runner docker run -d --name gitlab-runner --restart always \ -v $GITLAB_RUNNER_HOME/config:/etc/gitlab-runner \ -v /run/docker.sock:/var/run/docker.sock \ gitlab/gitlab-runner:latest
注册
docker run --rm -it -v $GITLAB_RUNNER_HOME/config:/etc/gitlab-runner gitlab/gitlab-runner register
建议使用shell模式,可以使用任意自定义脚本做构建