make in_docker work again (#1830)

This commit is contained in:
6543 2023-06-06 18:29:40 +02:00 committed by GitHub
parent 556607b525
commit 101e684059
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -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)

View file

@ -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" ]