From 02e3b4354573fc9c0ea34d0b351c6895806dcc7a Mon Sep 17 00:00:00 2001 From: Wan Bachtiar Date: Tue, 15 Dec 2020 17:07:37 +1100 Subject: [PATCH] Used the mounted path as the GOPATH --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0cdc4c..48cf92a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y \ rm -rf /var/lib/apt/lists/* RUN export uid=1000 gid=1000 && \ - mkdir -p /home/ubuntu && \ + mkdir -p /home/ubuntu && mkdir /workspace && \ echo "ubuntu:x:${uid}:${gid}:Developer,,,:/home/ubuntu:/bin/bash" >> /etc/passwd && \ echo "ubuntu:x:${uid}:" >> /etc/group && \ echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu && \ @@ -21,11 +21,12 @@ RUN export uid=1000 gid=1000 && \ chown ${uid}:${gid} -R /home/ubuntu ENV HOME /home/ubuntu +ENV WORKSPACE /workspace ENV GOROOT "/usr/local/go" -ENV GOPATH ${HOME} +ENV GOPATH ${WORKSPACE} ENV PATH "$PATH:$GOPATH/bin:$GOROOT/bin" -WORKDIR ${HOME} +WORKDIR ${WORKSPACE} RUN wget --quiet https://dl.google.com/go/go1.15.3.linux-amd64.tar.gz \ && tar -xf go1.15.3.linux-amd64.tar.gz \ @@ -34,7 +35,6 @@ RUN wget --quiet https://dl.google.com/go/go1.15.3.linux-amd64.tar.gz \ ENV DRIVER_VERSION ${DRIVER_VERSION} ENV MONGODB_URI ${MONGODB_URI} -RUN mkdir -p ${HOME}/go && mkdir /workspace COPY ./go/getstarted.go ${HOME}/go/getstarted.go COPY ./go/go.mod ${HOME}/go/go.mod