2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 11:28:54 +00:00
restic/Dockerfile

58 lines
1.8 KiB
Docker
Raw Normal View History

# 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 .
#
2016-02-20 16:00:12 +00:00
# run all tests and cross-compile restic:
# docker run --rm -v $PWD:/home/travis/restic restic/test go run run_integration_tests.go -minio minio
#
2016-02-20 16:00:12 +00:00
# run interactively:
# docker run --interactive --tty --rm -v $PWD:/home/travis/restic restic/test /bin/bash
#
2016-02-20 16:00:12 +00:00
# run a subset of tests:
# docker run --rm -v $PWD:/home/travis/restic restic/test gb test -v ./backend
#
# build the image for an older version of Go:
2017-02-10 16:25:48 +00:00
# docker build --build-arg GOVERSION=1.6.4 -t restic/test:go1.6.4 .
FROM ubuntu:14.04
2017-05-30 21:03:30 +00:00
ARG GOVERSION=1.8.3
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
# 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
# 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 GOPATH $HOME/gopath
2016-02-20 16:00:12 +00:00
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin:$HOME/bin
2016-02-20 16:00:12 +00:00
RUN mkdir -p $HOME/restic
# pre-install tools, this speeds up running the tests itself
2016-02-20 16:00:12 +00:00
RUN go get github.com/constabulary/gb/...
RUN go get golang.org/x/tools/cmd/cover
RUN go get github.com/mitchellh/gox
2016-01-17 17:50:50 +00:00
RUN go get github.com/pierrre/gotestcover
RUN mkdir $HOME/bin \
&& wget -q -O $HOME/bin/minio https://dl.minio.io/server/minio/release/linux-${GOARCH}/minio \
&& chmod +x $HOME/bin/minio
# set TRAVIS_BUILD_DIR for integration script
2016-02-20 16:00:12 +00:00
ENV TRAVIS_BUILD_DIR $HOME/restic
2016-02-20 16:00:12 +00:00
WORKDIR $HOME/restic