Skip to content

Commit

Permalink
Fix docker plugin build (#5240)
Browse files Browse the repository at this point in the history
- Rebuild the rootfs before each plugin build
  • Loading branch information
MasslessParticle authored Jan 27, 2022
1 parent a3fcd3c commit 8646436
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,25 @@ LOKI_DOCKER_DRIVER ?= "grafana/loki-docker-driver"
PLUGIN_TAG ?= $(IMAGE_TAG)
PLUGIN_ARCH ?=

docker-driver: docker-driver-clean
# build-rootfs
# builds the plugin rootfs
define build-rootfs
rm -rf clients/cmd/docker-driver/rootfs || true
mkdir clients/cmd/docker-driver/rootfs
docker build -t rootfsimage -f clients/cmd/docker-driver/Dockerfile .

ID=$$(docker create rootfsimage true) && \
(docker export $$ID | tar -x -C clients/cmd/docker-driver/rootfs) && \
docker rm -vf $$ID

docker rmi rootfsimage -f
endef

docker-driver: docker-driver-clean
$(build-rootfs)
docker plugin create $(LOKI_DOCKER_DRIVER):$(PLUGIN_TAG)$(PLUGIN_ARCH) clients/cmd/docker-driver

$(build-rootfs)
docker plugin create $(LOKI_DOCKER_DRIVER):main$(PLUGIN_ARCH) clients/cmd/docker-driver

clients/cmd/docker-driver/docker-driver: $(APP_GO_FILES)
Expand Down

0 comments on commit 8646436

Please sign in to comment.