diff --git a/.dockerignore b/.dockerignore index 0080de0..290e90f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,2 @@ -*.tzst -/buildimage -/dockerdeps -/tmp -*.docker.tzst *.tmp +*.dockerimage diff --git a/.gitignore b/.gitignore index 29bece0..105d015 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,5 @@ mfer/*.pb.go /mfer.cmd /tmp *.tmp -*.docker.tzst -*.tzst -/builddeps/modcache.tar +*.dockerimage /vendor diff --git a/Dockerfile b/Dockerfile index d8ba0b3..5c56ce3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,29 @@ ################################################################################ #2345678911234567892123456789312345678941234567895123456789612345678971234567898 ################################################################################ -FROM sneak/builder:14e59af AS builder +FROM sneak/builder:2022-12-08 AS builder ENV DEBIAN_FRONTEND noninteractive WORKDIR /build -COPY ./Makefile ./.golangci.yml ./go.mod ./go.sum . -COPY ./vendor.tar /build/vendor.tar +COPY ./Makefile ./.golangci.yml ./go.mod ./go.sum /build/ +COPY ./vendor.tzst /build/vendor.tzst +COPY ./modcache.tzst /build/modcache.tzst COPY ./internal ./internal COPY ./bin/gitrev.sh ./bin/gitrev.sh COPY ./mfer ./mfer COPY ./cmd ./cmd -RUN find /build ARG GITREV unknown + +RUN mkdir -p "$(go env GOMODCACHE)" && cd "$(go env GOMODCACHE)" && \ + zstdmt -d --stdout /build/modcache.tzst | tar xf - && \ + rm /build/modcache.tzst && cd /build RUN \ cd mfer && go generate . && cd .. && \ GOPACKAGESDEBUG=true golangci-lint run ./... && \ - tar xf vendor.tar && rm vendor.tar && \ + mkdir vendor && cd vendor && \ + zstdmt -d --stdout /build/vendor.tzst | tar xf - && rm /build/vendor.tzst && \ + cd .. && \ make mfer.cmd -RUN go mod vendor && tar -c . | zstdmt -19 > /src.tzst +RUN rm -rf /build/vendor && go mod vendor && tar -c . | zstdmt -19 > /src.tzst ################################################################################ #2345678911234567892123456789312345678941234567895123456789612345678971234567898 ################################################################################ diff --git a/Makefile b/Makefile index ad0e696..4efde9d 100644 --- a/Makefile +++ b/Makefile @@ -56,9 +56,9 @@ lint: golangci-lint run sh -c 'test -z "$$(gofmt -l .)"' -docker: sneak-mfer.$(ARCH).docker.tzst +docker: sneak-mfer.$(ARCH).tzst.dockerimage -sneak-mfer.$(ARCH).docker.tzst: $(SOURCEFILES) vendor.tar +sneak-mfer.$(ARCH).tzst.dockerimage: $(SOURCEFILES) vendor.tzst modcache.tzst docker build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer . docker save sneak/mfer | pv | zstdmt -19 > $@ du -sh $@ @@ -67,7 +67,16 @@ godoc: open http://127.0.0.1:6060 godoc -http=:6060 -vendor.tar: go.mod go.sum +vendor.tzst: go.mod go.sum + go mod tidy go mod vendor - tar -c vendor > $@ + cd vendor && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp rm -rf vendor + mv $@.tmp $@ + +modcache.tzst: go.mod go.sum + go mod tidy + cd $(HOME)/go/pkg && chmod -R u+rw . && rm -rf mod sumdb + go mod download -x + cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp + mv $@.tmp $@ diff --git a/modcache.tzst b/modcache.tzst new file mode 100644 index 0000000..0be2836 Binary files /dev/null and b/modcache.tzst differ diff --git a/vendor.tar b/vendor.tar deleted file mode 100644 index c509693..0000000 Binary files a/vendor.tar and /dev/null differ diff --git a/vendor.tzst b/vendor.tzst new file mode 100644 index 0000000..9f63bca Binary files /dev/null and b/vendor.tzst differ