how to configure hard memory limit for builds in d

2019-08-23 08:37发布

问题:

Perhaps I am missing it, but I see no method to control the the hard memory limit for any given build (I have builds being murdered because of it). Is the build memory limit based on the build params supplied by the client (this means a single client can bring down everything) or is there someplace I can configure the service to only allow 512mb (for example) per build?

回答1:

You can limit the max amount of memory per-container by setting the global DRONE_LIMIT_MEM variable (with the server). This should be set to the amount of memory in bytes, for example:

DRONE_LIMIT_MEM_SWAP=512000000
DRONE_LIMIT_MEM=512000000

These limits are passed to Docker when Drone starts a container [1]. It is the equivalent to the following Docker command:

docker run --memory=512000000 <image>

[1] https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory



标签: drone