diff --git a/Makefile b/Makefile index 2c3948645..e466a8aa8 100644 --- a/Makefile +++ b/Makefile @@ -35,17 +35,16 @@ ifeq (in_docker,$(firstword $(MAKECMDGOALS))) $(eval $(MAKE_ARGS):;@:) in_docker: - @[ "1" -eq "$(shell docker image ls woodpecker/make:local -a | wc -l)" ] && docker build -f ./docker/Dockerfile.make -t woodpecker/make:local . || echo reuse existing docker image + @[ "1" -eq "$(shell docker image ls woodpecker/make:local -a | wc -l)" ] && docker buildx build -f ./docker/Dockerfile.make -t woodpecker/make:local --load . || echo reuse existing docker image @echo run in docker: @docker run -it \ --user $(shell id -u):$(shell id -g) \ -e VERSION="$(VERSION)" \ -e BUILD_VERSION="$(BUILD_VERSION)" \ -e CI_COMMIT_SHA="$(CI_COMMIT_SHA)" \ - -e GO_PACKAGES="$(GO_PACKAGES)" \ -e TARGETOS="$(TARGETOS)" \ -e TARGETARCH="$(TARGETARCH)" \ - -e CGO_ENABLED="$(CGO_ENABLED)" + -e CGO_ENABLED="$(CGO_ENABLED)" \ -e GOPATH=/tmp/go \ -e HOME=/tmp/home \ -v $(PWD):/build --rm woodpecker/make:local make $(MAKE_ARGS) diff --git a/docker/Dockerfile.make b/docker/Dockerfile.make index a4730c80f..a668e5499 100644 --- a/docker/Dockerfile.make +++ b/docker/Dockerfile.make @@ -1,4 +1,4 @@ -# docker build --rm -f docker/Dockerfile.server -t woodpeckerci/woodpecker-server . +# docker build --rm -f docker/Dockerfile.make -t woodpecker/make:local . FROM golang:1.20-alpine as golang_image FROM node:18-alpine @@ -10,10 +10,11 @@ COPY --from=golang_image /usr/local/go /usr/local/go ENV PATH=$PATH:/usr/local/go/bin # Cache tools -RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && \ - go install github.com/rs/zerolog/cmd/lint@latest && \ - go install mvdan.cc/gofumpt@latest +RUN make install-tools && \ + mv /root/go/bin/* /usr/local/go/bin/ && \ + chmod 755 /usr/local/go/bin/* WORKDIR /build +RUN chmod -R 777 /root -CMD [ "sh" ] +CMD [ "/bin/sh" ]