Newer
Older
gitbucket / docker-compose.yml
version: '2.1'

services:
    main-gitbucket:
      image: pgollor/gitbucket:latest
      mem_limit: 2g
      restart: always
      depends_on:
        mysql-gitbucket:
          condition: service_healthy
      environment:
        - GITBUCKET_USER_ID=${GITBUCKET_USER_ID:-9000}
        - GITBUCKET_DATABASE_HOST=172.22.2.251
        - GITBUCKET_DATABASE_NAME=${GITBUCKET_DATABASE_NAME}
        - GITBUCKET_DATABASE_USER=${GITBUCKET_DATABASE_USER}
        - GITBUCKET_DATABASE_PASSWORD=${GITBUCKET_DATABASE_PASSWORD}
        - TZ=${TZ}
      volumes:
        - ./data/repositories/:/srv/gitbucket/repositories/
        - ./data/data/:/srv/gitbucket/data/
        - ./data/gist/:/srv/gitbucket/gist/
        - ./data/plugins/:/srv/gitbucket/plugins/
        #- ./data/tmp/:/srv/gitbucket/tmp/
        - ./data/conf/gitbucket/gitbucket.conf:/srv/gitbucket/gitbucket.conf
      tmpfs:
        - /tmp
      ports:
        - "${GITBUCKET_WEB_BIND:-127.0.0.1}:${GITBUCKET_WEB_PORT:-8080}:8080"
        - "${GITBUCKET_SSH_BIND:-127.0.0.1}:${GITBUCKET_SSH_PORT:-29418}:29418"
      networks:
        gitbucket-network:
          ipv4_address: 172.22.2.250
          aliases:
            - gitbucket

    mysql-gitbucket:
      image: mariadb:10.2
      restart: always
      command: mysqld --skip-name-resolve --skip-host-cache --log-warnings=0
      healthcheck:
        test: ["CMD", "mysqladmin", "-u$GITBUCKET_DATABASE_USER", "-p$GITBUCKET_DATABASE_PASSWORD",  "ping", "-h", "localhost"]
        interval: 30s
        timeout: 30s
        retries: 10
      environment:
        - MYSQL_ROOT_PASSWORD=${GITBUCKET_DATABASE_ROOT}
        - MYSQL_DATABASE=${GITBUCKET_DATABASE_NAME}
        - MYSQL_USER=${GITBUCKET_DATABASE_USER}
        - MYSQL_PASSWORD=${GITBUCKET_DATABASE_PASSWORD}
      volumes:
        - mysql-vol-1:/var/lib/mysql/
        - ./data/conf/mysql:/etc/mysql/conf.d/:ro
      networks:
        gitbucket-network:
          ipv4_address: 172.22.2.251
          aliases:
            - mysql

networks:
  gitbucket-network:
    driver: bridge
    enable_ipv6: false
    ipam:
      driver: default
      config:
        - subnet: 172.22.2.0/24

volumes:
  mysql-vol-1: