I notice in the source for the drone plugin, docker build
is always run with the --rm
flag.
I have docker files that are structured to utilize layer caching where possible, with things like:
FROM golang:1.13 as builder
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -o myApp ./
If run repeatedly on the same agent, I would hope that the module downloading would take advantage of the docker layer cache, and it does if I run docker build myself. But in drone, the --rm flag causes docker to clean up the intermediate images, and every build takes pretty constant time.
I’d like to have an option to disable that feature. There is already the purge
argument to the plugin, and I assumed that would do what I want. Took some digging in the logs to realize purge
still doesn’t preserve the intermediate containers.
I’d prefer just re-using the purge
flag, but I could see maybe adding a new one if that is problematic. Would you accept a pull request to that effect?