Skip to content

Commit

Permalink
Dockerfile: Install go in home dir
Browse files Browse the repository at this point in the history
This allows cross-compilation with gox with Go < 1.5
  • Loading branch information
fd0 committed Dec 20, 2015
1 parent a8c05f8 commit 0346a78
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,23 @@ ARG GOARCH=amd64
RUN apt-get update
RUN apt-get install -y --no-install-recommends ca-certificates wget git build-essential

# download and install Go
RUN wget -q -O /tmp/go.tar.gz https://storage.googleapis.com/golang/go${GOVERSION}.linux-${GOARCH}.tar.gz
RUN cd /var/lib && tar xf /tmp/go.tar.gz
RUN rm -f /tmp/go.tar.gz

ENV GOROOT /var/lib/go
ENV PATH $PATH:$GOROOT/bin

# add and configure user
ENV HOME /home/travis
ENV GOPATH $HOME/gopath
ENV PATH $PATH:$GOPATH/bin
RUN useradd -m -d $HOME -s /bin/bash travis

# run everything below as user travis
USER travis
WORKDIR $HOME

# make gopath
# download and install Go
RUN wget -q -O /tmp/go.tar.gz https://storage.googleapis.com/golang/go${GOVERSION}.linux-${GOARCH}.tar.gz
RUN tar xf /tmp/go.tar.gz && rm -f /tmp/go.tar.gz
ENV GOROOT $HOME/go
ENV PATH $PATH:$GOROOT/bin

ENV GOPATH $HOME/gopath
ENV PATH $PATH:$GOPATH/bin

RUN mkdir -p $GOPATH/src/github.com/restic/restic

# install tools
Expand Down

0 comments on commit 0346a78

Please sign in to comment.