How to set memory on drone.yml file to configure docker container memory

1.8k views Asked by At

I setup drone.io instance locally and use it as our CI environment. I need to setup the docker container memory for running my test cases. Below is my .drone.yml file.

pipeline:
  build:
    image: centor
    commands:
      - mvn clean install

Is there a way for me to set the maximum memory in the docker container?

1

There are 1 answers

2
Brad Rydzewski On BEST ANSWER

The .drone.yml file is a superset of the docker-compose file and supports the mem_limit field [1]

pipeline:
  build:
    image: golang
    commands:
      - go build
      - go test
    mem_limit: 1000000000

Note that this field is only available in Drone version 0.5 and higher. So unfortunately it is not backported to older versions of Drone.

[1] https://docs.docker.com/compose/compose-file/#/cpushares-cpuquota-cpuset-domainname-hostname-ipc-macaddress-memlimit-memswaplimit-oomscoreadj-privileged-readonly-restart-shmsize-stdinopen-tty-user-workingdir