is there a way in docker plugin to build only a specific target?
On my machine I would just provide DOCKER_BUILDKIT=1, is there a way to achieve this with docker plugin?
I haven’t tried the latest Drone, but I did this some months ago with Drone 0.8:
build-image:
image: docker:18.09
commands:
- >-
docker image build
-f Dockerfile
--tag $DOCKER_REPO:${DRONE_COMMIT}
--tag $DOCKER_REPO:latest
--pull
--target production
--build-arg DRONE_BRANCH=${DRONE_BRANCH}
--build-arg DRONE_COMMIT=${DRONE_COMMIT}
--label org.label-schema.schema-version=1.0
--label org.label-schema.build-date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
--label org.label-schema.vcs-ref=${DRONE_COMMIT}
--label org.label-schema.vcs-url=https://example.com/scm/org/repo.git
.
- echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin
- docker image push $DOCKER_REPO:${DRONE_COMMIT}
- docker image push $DOCKER_REPO:latest
- docker image rm $DOCKER_REPO:${DRONE_COMMIT} $DOCKER_REPO:latest
- docker image prune -f
environment:
- DOCKER_BUILDKIT=1
- DOCKER_REPO=org/repo
secrets:
- docker_username
- docker_password
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
branch:
- master
event: push