Skip to content

Instantly share code, notes, and snippets.

@linuxsimba
Last active November 2, 2023 10:09
Show Gist options
  • Save linuxsimba/0be4b014b1aeedcf01f18b4a2548d8e4 to your computer and use it in GitHub Desktop.
Save linuxsimba/0be4b014b1aeedcf01f18b4a2548d8e4 to your computer and use it in GitHub Desktop.
docker-compose for setting up gitlab
version: '2'
networks:
gitlab_net:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.201.0/24
gateway: 192.168.201.1
services:
prod_pypi:
image: linuxsimba/devpi
container_name: prod_pypi
ports:
- "9200:3141"
volumes:
- ${HOME}/prod_pypi:/data
networks:
gitlab_net:
ipv4_address: 192.168.201.13
environment:
- DEVPI_PASSWORD=mysecretpass
staging_pypi:
image: linuxsimba/devpi
container_name: staging_pypi
networks:
gitlab_net:
ipv4_address: 192.168.201.12
ports:
- "9100:3141"
volumes:
- ${HOME}/staging_pypi:/data
environment:
- DEVPI_PASSWORD=mysecretpass
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
hostname: gitlab.linuxsimba.test
ports:
- "9080:80"
- "9443:443"
- "9022:22"
volumes:
- ${HOME}/gitlab/config:/etc/gitlab
- ${HOME}/gitlab/logs:/var/log/gitlab
- ${HOME}/gitlab/data:/var/opt/gitlab
networks:
gitlab_net:
ipv4_address: 192.168.201.10
gitlab-runner:
image: gitlab/gitlab-runner:latest
container_name: gitlab-runner
dns_search: linuxsimba.test
networks:
- gitlab_net
extra_hosts:
- "gitlab.linuxsimba.test:192.168.201.10"
volumes:
- ${HOME}/gitlab-runner/config:/etc/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock
environment:
# the Docker network resolves the docker name has a DNS name. That is
# why you can say http://staging_pypi:3141 or http://gitlab from within
# this docker container. Read more about docker networking from the docker
# website.
- CI_SERVER_URL=http://gitlab/ci
# This registration token can only be used once a Project/git repo is recreated.
- REGISTRATION_TOKEN=
- RUNNER_NAME=python_docker
- RUNNER_EXECUTOR=docker
- DOCKER_IMAGE=python:2.7.12-alpine
# Notice that it matches exactly the network found in docker network ls
- DOCKER_NETWORK_MODE=gitlab_gitlab_net
- DOCKER_EXTRA_HOSTS=gitlab.linuxsimba.test:192.168.201.10
@robertomanfreda
Copy link

Nice use of the ipam! Ty for sharing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment