I'm using a declarative Jenkinsfile to run some stages inside a Docker container. The process works okay but the build times are often very slow as our CI has quite a few slaves and if the build occurs on a slave without the layer cache, the entire build takes a while.
I've read that Docker can speed up builds if a --cache-from flag is specified. How do I specify the cache-from flag and the external registry's URL and credentials?
pipeline {
agent { dockerfile true }
environment {
REPO = credentials('supersecret')
}
stages {
stage('Prepare environment') {
steps {