config tool now runs with user permissions so we don't run into trouble on linux

This commit is contained in:
jash
2018-10-09 21:42:08 +02:00
committed by kexkey
parent 360a65d9da
commit 2108930fb9
2 changed files with 26 additions and 18 deletions

View File

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

View File

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