latest with caching
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jeffrey Paul 2022-12-09 01:40:33 +04:00
parent 587f9420ea
commit 4087fe005b
7 changed files with 30 additions and 20 deletions

View File

@ -1,6 +1,2 @@
*.tzst
/buildimage
/dockerdeps
/tmp
*.docker.tzst
*.tmp *.tmp
*.dockerimage

4
.gitignore vendored
View File

@ -2,7 +2,5 @@ mfer/*.pb.go
/mfer.cmd /mfer.cmd
/tmp /tmp
*.tmp *.tmp
*.docker.tzst *.dockerimage
*.tzst
/builddeps/modcache.tar
/vendor /vendor

View File

@ -1,23 +1,30 @@
################################################################################ ################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898 #2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################ ################################################################################
FROM sneak/builder:14e59af AS builder FROM sneak/builder:2022-12-08 AS builder
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
WORKDIR /build WORKDIR /build
COPY ./Makefile ./.golangci.yml ./go.mod ./go.sum . COPY ./.git /build/.git
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 ./internal ./internal
COPY ./bin/gitrev.sh ./bin/gitrev.sh COPY ./bin/gitrev.sh ./bin/gitrev.sh
COPY ./mfer ./mfer COPY ./mfer ./mfer
COPY ./cmd ./cmd COPY ./cmd ./cmd
RUN find /build
ARG GITREV unknown 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 \ RUN \
cd mfer && go generate . && cd .. && \ cd mfer && go generate . && cd .. && \
GOPACKAGESDEBUG=true golangci-lint run ./... && \ 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 make mfer.cmd
RUN go mod vendor && tar -c . | zstdmt -19 > /src.tzst RUN rm -rf /build/vendor /build/.git && go mod vendor && tar -c . | zstdmt -19 > /src.tzst
################################################################################ ################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898 #2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################ ################################################################################

View File

@ -44,9 +44,9 @@ mfer.cmd: $(SOURCEFILES) mfer/mf.pb.go
cd cmd/mfer && go build -tags urfave_cli_no_docs -o ../../mfer.cmd $(GOFLAGS) . cd cmd/mfer && go build -tags urfave_cli_no_docs -o ../../mfer.cmd $(GOFLAGS) .
clean: clean:
rm -rfv mfer/*.pb.go mfer.cmd cmd/mfer/mfer rm -rfv mfer/*.pb.go mfer.cmd cmd/mfer/mfer *.dockerimage
fmt: fmt: mfer/mf.pb.go
gofumpt -l -w mfer internal cmd gofumpt -l -w mfer internal cmd
golangci-lint run --fix golangci-lint run --fix
-prettier -w *.json -prettier -w *.json
@ -56,9 +56,9 @@ lint:
golangci-lint run golangci-lint run
sh -c 'test -z "$$(gofmt -l .)"' 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 build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer .
docker save sneak/mfer | pv | zstdmt -19 > $@ docker save sneak/mfer | pv | zstdmt -19 > $@
du -sh $@ du -sh $@
@ -67,7 +67,16 @@ godoc:
open http://127.0.0.1:6060 open http://127.0.0.1:6060
godoc -http=:6060 godoc -http=:6060
vendor.tar: go.mod go.sum vendor.tzst: go.mod go.sum
go mod tidy
go mod vendor go mod vendor
tar -c vendor > $@ cd vendor && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp
rm -rf vendor 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 $@

BIN
modcache.tzst Normal file

Binary file not shown.

Binary file not shown.

BIN
vendor.tzst Normal file

Binary file not shown.