buildkit/Makefile

61 lines
1.6 KiB
Makefile
Raw Normal View History

BINARIES=bin/buildkitd bin/buildctl
BINARIES_EXTRA=bin/buildkitd.oci_only bin/buildkitd.containerd_only bin/buildctl-darwin bin/buildkitd.exe bin/buildctl.exe
DESTDIR=/usr/local
binaries: $(BINARIES)
binaries-all: $(BINARIES) $(BINARIES_EXTRA)
bin/buildctl-darwin: FORCE
mkdir -p bin
docker build --build-arg GOOS=darwin -t buildkit:buildctl-darwin --target buildctl -f ./hack/dockerfiles/test.Dockerfile --force-rm .
( containerID=$$(docker create buildkit:buildctl-darwin noop); \
docker cp $$containerID:/usr/bin/buildctl $@; \
docker rm $$containerID )
chmod +x $@
bin/%.exe: FORCE
mkdir -p bin
docker build -t buildkit:$*.exe --target $*.exe -f ./hack/dockerfiles/test.Dockerfile --force-rm .
( containerID=$$(docker create buildkit:$*.exe noop); \
docker cp $$containerID:/$*.exe $@; \
docker rm $$containerID )
chmod +x $@
bin/%: FORCE
mkdir -p bin
docker build -t buildkit:$* --target $* -f ./hack/dockerfiles/test.Dockerfile --force-rm .
( containerID=$$(docker create buildkit:$* noop); \
docker cp $$containerID:/usr/bin/$* $@; \
docker rm $$containerID )
chmod +x $@
install: FORCE
mkdir -p $(DESTDIR)/bin
install $(BINARIES) $(DESTDIR)/bin
clean: FORCE
rm -rf ./bin
test:
./hack/test
lint:
./hack/lint
validate-vendor:
./hack/validate-vendor
Validation and (controlled) generation for go generate'd files. Modelled after the vendor support provide a validator and an updator for files produced by `go generate` (which today just means `*.pb.go`). Main difference from the vendor support is that we are no longer simply nuking and replacing a single directory, so I ended up hardcoding `*.pb.go` in a bunch of places which I don't like but cannot see a way around which doesn't risk nuking people's other local changes. The generated files are placed in an unpacked form in a `FROM scratch` container for update. Use a subdirectory and `tar --strip-components` (portable to MacOS and Linux according to `tar(1)`) since trying to do a `docker export` of just the root ends up adding `.dockerenv`, `sys`, `proc` and `dev` to the source tree. The validate container is not `FROM scratch` because we want `cat`. The run in `frontend/gateway/pb/generate.go` was missing an include so fix that. The versions of `protoc` and the gogo plugins were chosen to regenerate the existing code as closely as possible. The updates to `*.pg.go` here are all the result of regenerating with go1.9 which fixed https://github.com/golang/go/issues/17663 and replaced an invalid timestamp in the gzip header of the data encoded in `fileDescriptor*`, and adopted a new standard for marking generated files. Finally, I noticed that my `docker run`s were missing an `--rm` which I inherited from `validate-vendor`, so fix all those. Closes: #322 Signed-off-by: Ian Campbell <ijc@docker.com>
2018-03-26 10:52:36 +00:00
validate-generated-files:
./hack/validate-generated-files
validate-all: test lint validate-vendor validate-generated-files
vendor:
./hack/update-vendor
Validation and (controlled) generation for go generate'd files. Modelled after the vendor support provide a validator and an updator for files produced by `go generate` (which today just means `*.pb.go`). Main difference from the vendor support is that we are no longer simply nuking and replacing a single directory, so I ended up hardcoding `*.pb.go` in a bunch of places which I don't like but cannot see a way around which doesn't risk nuking people's other local changes. The generated files are placed in an unpacked form in a `FROM scratch` container for update. Use a subdirectory and `tar --strip-components` (portable to MacOS and Linux according to `tar(1)`) since trying to do a `docker export` of just the root ends up adding `.dockerenv`, `sys`, `proc` and `dev` to the source tree. The validate container is not `FROM scratch` because we want `cat`. The run in `frontend/gateway/pb/generate.go` was missing an include so fix that. The versions of `protoc` and the gogo plugins were chosen to regenerate the existing code as closely as possible. The updates to `*.pg.go` here are all the result of regenerating with go1.9 which fixed https://github.com/golang/go/issues/17663 and replaced an invalid timestamp in the gzip header of the data encoded in `fileDescriptor*`, and adopted a new standard for marking generated files. Finally, I noticed that my `docker run`s were missing an `--rm` which I inherited from `validate-vendor`, so fix all those. Closes: #322 Signed-off-by: Ian Campbell <ijc@docker.com>
2018-03-26 10:52:36 +00:00
generated-files:
./hack/update-generated-files
.PHONY: vendor generated-files test binaries binaries-all install clean lint validate-all validate-vendor validate-generated-files
FORCE: