2015-12-19 14:57:22 +00:00
|
|
|
# This Dockerfiles configures a container that is similar to the Travis CI
|
|
|
|
# environment and can be used to run tests locally.
|
|
|
|
#
|
|
|
|
# build the image:
|
|
|
|
# docker build -t restic/test .
|
|
|
|
#
|
|
|
|
# run tests:
|
|
|
|
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go run run_integration_tests.go
|
|
|
|
#
|
|
|
|
# run interactively with:
|
|
|
|
# docker run --interactive --tty --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test /bin/bash
|
|
|
|
#
|
|
|
|
# run a tests:
|
|
|
|
# docker run --rm -v $PWD:/home/travis/gopath/src/github.com/restic/restic restic/test go test -v ./backend
|
|
|
|
|
|
|
|
FROM ubuntu:14.04
|
|
|
|
|
2016-01-17 17:50:50 +00:00
|
|
|
ARG GOVERSION=1.5.3
|
2015-12-19 14:57:22 +00:00
|
|
|
ARG GOARCH=amd64
|
|
|
|
|
|
|
|
# install dependencies
|
|
|
|
RUN apt-get update
|
2016-01-02 14:33:25 +00:00
|
|
|
RUN apt-get install -y --no-install-recommends ca-certificates wget git build-essential openssh-server
|
2015-12-19 14:57:22 +00:00
|
|
|
|
|
|
|
# add and configure user
|
|
|
|
ENV HOME /home/travis
|
|
|
|
RUN useradd -m -d $HOME -s /bin/bash travis
|
|
|
|
|
|
|
|
# run everything below as user travis
|
|
|
|
USER travis
|
|
|
|
WORKDIR $HOME
|
|
|
|
|
2015-12-20 17:10:29 +00:00
|
|
|
# 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
|
|
|
|
|
2015-12-19 14:57:22 +00:00
|
|
|
RUN mkdir -p $GOPATH/src/github.com/restic/restic
|
|
|
|
|
2016-01-26 22:42:45 +00:00
|
|
|
# pre-install tools, this speeds up running the tests itself
|
|
|
|
RUN go get github.com/tools/godep
|
2015-12-19 14:57:22 +00:00
|
|
|
RUN go get golang.org/x/tools/cmd/cover
|
|
|
|
RUN go get github.com/mattn/goveralls
|
|
|
|
RUN go get github.com/mitchellh/gox
|
2016-01-17 17:50:50 +00:00
|
|
|
RUN go get github.com/pierrre/gotestcover
|
2016-01-26 22:42:45 +00:00
|
|
|
RUN mkdir $HOME/bin \
|
2016-01-26 22:52:39 +00:00
|
|
|
&& wget -q -O $HOME/bin/minio https://dl.minio.io/server/minio/release/linux-${GOARCH}/minio \
|
2016-01-26 22:42:45 +00:00
|
|
|
&& chmod +x $HOME/bin/minio
|
2015-12-19 14:57:22 +00:00
|
|
|
|
|
|
|
# set TRAVIS_BUILD_DIR for integration script
|
|
|
|
ENV TRAVIS_BUILD_DIR $GOPATH/src/github.com/restic/restic
|
|
|
|
ENV GOPATH $GOPATH:${TRAVIS_BUILD_DIR}/Godeps/_workspace
|
|
|
|
|
|
|
|
WORKDIR $TRAVIS_BUILD_DIR
|