Skip to content

Instantly share code, notes, and snippets.

@avraampiperidis
Last active October 1, 2021 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avraampiperidis/7ab674a7ea6a35605f38731c21551a12 to your computer and use it in GitHub Desktop.
Save avraampiperidis/7ab674a7ea6a35605f38731c21551a12 to your computer and use it in GitHub Desktop.
Docker-compose with gitlab and gitlab-runner services.
GITLAB_IMAGE=gitlab/gitlab-ee:latest
GITLAB_RUNNER_IMAGE=gitlab/gitlab-runner:alpine
GITLAB_HOME=/srv/gitlab
GITLAB_HOST=localhost
#ports
HTTP_PORT=80
HTTPS_PORT=443
SSH_PORT=23
REGISTRY_PORT=5050
# This docker compose will start two services,
# a gitlab instance and a gitlab-runner instance.
# .env file contains the environment variables with default values that the user should update
version: "3.5"
services:
gitlab:
image: "${GITLAB_IMAGE}"
restart: always
hostname: "${GITLAB_HOST}"
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://${GITLAB_HOST}'
registry_external_url 'https://${GITLAB_HOST}:${REGISTRY_PORT}'
gitlab_rails['gitlab_shell_ssh_port'] = 22
ports:
- "${HTTP_PORT}:80"
- "${HTTPS_PORT}:443"
- "${SSH_PORT}:22"
- "${REGISTRY_PORT}:5050"
volumes:
- "${GITLAB_HOME}/config:/etc/gitlab"
- "${GITLAB_HOME}/logs:/var/log/gitlab"
- "${GITLAB_HOME}/data:/var/opt/gitlab"
networks:
- gitlab
gitlab-runner:
image: ${GITLAB_RUNNER_IMAGE}
restart: unless-stopped
depends_on:
- gitlab
volumes:
- ${GITLAB_HOME}/gitlab-runner:/etc/gitlab-runner
- ${GITLAB_HOME}/config/ssl:/certs
- /var/run/docker.sock:/var/run/docker.sock
networks:
- gitlab
networks:
gitlab:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment