Skip to content

Instantly share code, notes, and snippets.

@vranystepan
Last active February 25, 2022 20:56
Show Gist options
  • Save vranystepan/d2535c2e4d9280d2e298625271ba66f7 to your computer and use it in GitHub Desktop.
Save vranystepan/d2535c2e4d9280d2e298625271ba66f7 to your computer and use it in GitHub Desktop.

Running Gitlab-CI and Minio with docker-compose

features

method

Generate some random string for minio

</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c32; echo ""

create docker-compose file

version: "3.7"
services:
  gitlab-runner:
    image: gitlab/gitlab-runner:latest
    volumes:
      - runner-config:/etc/gitlab-runner
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - gitlab-ci

  gitlab-minio:
    image: minio/minio:latest
    volumes:
      - minio-config:/root/.minio
      - minio-data:/export
    networks:
      - gitlab-ci
    ports:
      - 9005:9000
    command:
      - server 
      - /export
    environment:
      MINIO_ACCESS_KEY: <your fisrt key>
      MINIO_SECRET_KEY: <your second key>


volumes:
  runner-config:
  minio-data:
  minio-config:

networks:
  gitlab-ci:
    name: gitlab-ci

start both services

docker-compose up -d

prepare Minio

  • open Minio and create bucket ci-cache

open runner container and execute

gitlab-runner register -n \
   --url https://gitlab.com/ \
   --registration-token <gitlab token> \
   --executor docker \
   --docker-network-mode=root_gitlab-ci \
   --description "My Docker Runner" \
   --docker-image "docker:stable" \
   --cache-type=s3 \
   --cache-path="" \
   --cache-shared=true \
   --cache-s3-server-address=gitlab-minio:9000 \
   --cache-s3-access-key=<your first key> \
   --cache-s3-secret-key=<your second key> \
   --cache-s3-bucket-name=ci-cache \
   --cache-s3-insecure \
   --docker-volumes /var/run/docker.sock:/var/run/docker.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment