From 351e964e4eecc17ac4c45f345eb32557168d643c Mon Sep 17 00:00:00 2001 From: jannfis Date: Fri, 26 Jul 2019 19:46:45 +0200 Subject: [PATCH] Allow codegen to run as non-root user in the Docker container (#2032) --- Makefile | 2 +- hack/Dockerfile.dev-tools | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b65e987b5f637..1b37ef339cfa8 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ codegen-local: protogen clientgen openapigen manifests .PHONY: codegen codegen: dev-tools-image - docker run --rm -it -v ${CURRENT_DIR}:/go/src/github.com/argoproj/argo-cd -w /go/src/github.com/argoproj/argo-cd argocd-dev-tools bash -c "GOPATH=/go make codegen-local" + docker run --rm -it -u $(shell id -u) -e HOME=/home/user -v ${CURRENT_DIR}:/go/src/github.com/argoproj/argo-cd -w /go/src/github.com/argoproj/argo-cd argocd-dev-tools bash -c "GOPATH=/go make codegen-local" .PHONY: cli cli: clean-debug diff --git a/hack/Dockerfile.dev-tools b/hack/Dockerfile.dev-tools index 14cc310d79808..d8ea02ae50fec 100644 --- a/hack/Dockerfile.dev-tools +++ b/hack/Dockerfile.dev-tools @@ -33,7 +33,8 @@ RUN wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-li mv /tmp/linux-amd64/helm /usr/local/bin/helm && \ helm version --client -RUN helm init --client-only +RUN mkdir -p /home/user && chmod 777 /home/user +RUN HELM_HOME=/home/user/.helm helm init --client-only RUN apt-get update && apt-get install -y \ zip && \ @@ -55,3 +56,5 @@ RUN curl -sLf -C - -o /tmp/jq https://github.com/stedolan/jq/releases/download/j cp /tmp/jq /usr/local/bin/jq && \ chmod +x /usr/local/bin/jq && \ jq --version + +RUN mkdir -p /go/pkg && chmod 777 /go/pkg