From 20aa69c286c70fae1b4afeacb53f471cb7d17af2 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 11 Jul 2016 10:21:31 -0400 Subject: [PATCH] docker: do not install in /root as it is not accessible to unprivileged user Signed-off-by: Jean Privat --- misc/docker/Dockerfile | 6 +++--- misc/docker/README.md | 12 ++++++------ misc/docker/full/Dockerfile | 5 +---- misc/docker/hello/Dockerfile | 8 ++++---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/misc/docker/Dockerfile b/misc/docker/Dockerfile index 95995bf..a1d602c 100644 --- a/misc/docker/Dockerfile +++ b/misc/docker/Dockerfile @@ -21,8 +21,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins && rm -rf /var/lib/apt/lists/* # Clone and compile -RUN git clone https://github.com/nitlang/nit.git /root/nit \ - && cd /root/nit \ +RUN git clone https://github.com/nitlang/nit.git /nit \ + && cd /nit \ && make \ && . misc/nit_env.sh install \ # Clean and reduce size @@ -30,6 +30,6 @@ RUN git clone https://github.com/nitlang/nit.git /root/nit \ && ccache -C \ && rm -rf .git -ENV NIT_DIR /root/nit +ENV NIT_DIR /nit ENV PATH $NIT_DIR/bin:$PATH WORKDIR $NIT_DIR diff --git a/misc/docker/README.md b/misc/docker/README.md index d255285..73dbba9 100644 --- a/misc/docker/README.md +++ b/misc/docker/README.md @@ -24,8 +24,8 @@ You can use these images to build then run your programs. ~~~ host$ docker run -ti nitlang/nit -root@ce9b671dd9fc:/root/nit# nitc examples/hello_world.nit -root@ce9b671dd9fc:/root/nit# ./hello_world +root@ce9b671dd9fc:/nit# nitc examples/hello_world.nit +root@ce9b671dd9fc:/nit# ./hello_world hello world ~~~ @@ -37,11 +37,11 @@ In your Dockerfile, write something like: FROM nitlang/nit # Create a workdir -RUN mkdir -p /root/work -WORKDIR /root/work +RUN mkdir -p /work +WORKDIR /work -# Copy the source code in /root/work/ -COPY . /root/work/ +# Copy the source code in /work/ +COPY . /work/ # Compile RUN nitc src/hello.nit --dir . \ diff --git a/misc/docker/full/Dockerfile b/misc/docker/full/Dockerfile index df0d214..fe6fa82 100644 --- a/misc/docker/full/Dockerfile +++ b/misc/docker/full/Dockerfile @@ -63,7 +63,7 @@ ENV ANDROID_NDK /opt/android-ndk ENV PATH $PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK # Run tests -RUN cd /root/nit/tests \ +RUN cd /nit/tests \ # Basic tests && ./testfull.sh || true \ && rm -rf out/ alt/*.nit \ @@ -71,6 +71,3 @@ RUN cd /root/nit/tests \ && ../bin/nitunit ../lib ../contrib || true \ && rm -rf .nitunit \ && ccache -C - -WORKDIR /root/nit -ENTRYPOINT [ "bash" ] diff --git a/misc/docker/hello/Dockerfile b/misc/docker/hello/Dockerfile index c0a018b..ad7e3cd 100644 --- a/misc/docker/hello/Dockerfile +++ b/misc/docker/hello/Dockerfile @@ -1,11 +1,11 @@ FROM nitlang/nit # Create a workdir -RUN mkdir -p /root/work -WORKDIR /root/work +RUN mkdir -p /work +WORKDIR /work -# Copy the source code in /root/work/ -COPY . /root/work/ +# Copy the source code in /work/ +COPY . /work/ # Compile RUN nitc src/hello.nit --dir . \ -- 1.7.9.5