GitLab-CI Multi Runner php composer cache

前端 未结 2 791
甜味超标
甜味超标 2020-12-28 16:20

I\'m using gitlab-ci-multi-runner with docker containers. Everything is going fine, but docker containers don\'t keep the composer cache so in every run c

相关标签:
2条回答
  • 2020-12-28 16:35

    You could modify the composer cache path and write the stuff to a docker volume.

    That storage is persistent and can be shared across containers.

    Referencing:

    • https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/configuration/advanced-configuration.md#volumes-in-the-runnersdocker-section
    • https://docs.docker.com/engine/admin/volumes/volumes/
    0 讨论(0)
  • 2020-12-28 16:49

    You can change the composer cache path by exporting the COMPOSER_CACHE_DIR environment variable in your runner configuration file, and then add a volume in the [runners.docker] section to match it.

    If you run gitlab-runner as root or with sudo, then your configuration file is located at /etc/gitlab-runner/config.toml. Otherwise it's located at $HOME/.gitlab-runner/config.toml.

    # config.toml
    
    [[runners]]
      name = "Generic Docker Runner"
      ...
      environment = ["COMPOSER_CACHE_DIR=/cache"]
      executor = "docker"
      [runners.docker]
        ...
        volumes = ["/var/cache:/cache:rw"]
        cache_dir = "/cache"
    
    0 讨论(0)
提交回复
热议问题