From 2108930fb985940805f0c57efd1ab1dc254bacd2 Mon Sep 17 00:00:00 2001 From: jash Date: Tue, 9 Oct 2018 21:42:08 +0200 Subject: [PATCH] config tool now runs with user permissions so we don't run into trouble on linux --- install/Dockerfile | 41 ++++++++++++++++++++++--------------- install/script/configure.sh | 3 ++- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/install/Dockerfile b/install/Dockerfile index 0a7691e..73dc362 100644 --- a/install/Dockerfile +++ b/install/Dockerfile @@ -1,25 +1,32 @@ +FROM alpine as builder + +RUN set -x\ + && apk add --no-cache\ + gcc\ + make\ + git\ + musl-dev + +RUN git clone https://github.com/ncopa/su-exec.git /su-exec + +WORKDIR /su-exec +RUN make +RUN strip su-exec + FROM node:alpine -RUN apk add --update bash && rm -rf /var/cache/apk/* -RUN adduser -D -h /yo yo yo -RUN chown -R yo:yo /usr/local/lib/node_modules /usr/local/bin +COPY --from=builder /su-exec/su-exec /sbin/ + +RUN apk add --update bash && rm -rf /var/cache/apk/* +RUN mkdir -p /app +RUN mkdir /.config +RUN chmod a+rwx /.config -USER yo RUN npm install -g yo -COPY generator-cyphernode /yo -WORKDIR /yo/generator-cyphernode +COPY generator-cyphernode /app +WORKDIR /app/generator-cyphernode RUN npm link -USER root -RUN mkdir -p /yo/.config/insight-nodejs - -# prevent "do you want to send stats"-questions for temporary yo installation -COPY insight-yo.json /yo/.config/insight-nodejs/insight-yo.json -RUN chown -R yo:yo /yo/.config - -# run in user space -USER yo WORKDIR /data -ENTRYPOINT ["yo","cyphernode"] - +ENTRYPOINT ["/sbin/su-exec"] diff --git a/install/script/configure.sh b/install/script/configure.sh index c290f95..d490efb 100644 --- a/install/script/configure.sh +++ b/install/script/configure.sh @@ -13,5 +13,6 @@ configure() { # configure features of cyphernode docker run -v $current_path/../data:/data \ --log-driver=none\ - --rm -it cyphernodeconf:latest $recreate + --rm -it cyphernodeconf:latest $(id -u):$(id -g) yo --no-insight cyphernode $recreate } +