我想在服务器上用 Docker
部署 Gitlab + CI/CD
,我想用一个 docker-compose
把配置全写好.
Github
上看了不少,也做了不少尝试,但水平有限,希望各位指点下,也可以加bnpiZXRh
,一起趟坑.
我的 runner 是不是不应该写在这里, 因为可能会有好几个.
多谢.
version: '3'
services:
gitlab:
image: gitlab/gitlab-ce
restart: always
container_name: gitlab-ce
hostname: "${SERVER_IP}"
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url "http://${SERVER_IP}:9001"
gitlab_rails['time_zone'] = 'Pacific/Auckland'
gitlab_rails['gitlab_shell_ssh_port'] = 9002
letsencrypt['enable'] = false
# Configure headers for outgoing email.
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'no-reply@${SERVER_IP}'
gitlab_rails['gitlab_email_display_name'] = 'GitLab'
gitlab_rails['gitlab_email_reply_to'] = 'no-reply@${SERVER_IP}'
# Send outgoing email via the SMTP container:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_tls'] = false
# Limit backup lifetime to 7 days (604800 seconds):
# gitlab_rails['backup_keep_time'] = 604800
# GitLab Pages
pages_external_url "http://${SERVER_IP}:9005"
ports:
# - '9003:80'
# - '9004:443'
- '9001:9090'
- '9002:22'
volumes:
- ./volumes/config:/etc/gitlab
- ./volumes/logs:/var/log/gitlab
- ./volumes/data:/var/opt/gitlab
depends_on:
- redis
- postgres
mail:
image: bytemark/smtp
container_name: gitlab-mail
restart: always
runner:
image: gitlab/gitlab-runner
restart: always
container_name: gitlab_runner
environment:
- CI_SERVER_URL=http://${SERVER_IP}:9001/
volumes:
- ./volumes/runner/runner1:/etc/gitlab-runner
- ./volumes/runner/runner1/var/docker.sock:/var/run/docker.sock:rw
postgres:
image: postgres
restart: always
container_name: gitlab_pg
# http://github.com/docker-library/docs/tree/master/postgres#environment-variables
environment:
POSTGRES_USER: gitlab
POSTGRES_PASSWORD: gitlab
POSTGRES_DB: gitlab
volumes:
- ./volumes/postgres:/var/lib/postgresql/data
restart: always
redis:
image: redis
restart: always
container_name: gitlab_redis
command:
- --loglevel warning
volumes:
- ./volumes/postgres:/var/lib/redis
restart: always
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.