mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 14:56:29 +00:00
Add Dockerfile that resembles the Travis environment
This commit is contained in:
parent
5736742c3e
commit
c22c0f2706
55
Dockerfile
Normal file
55
Dockerfile
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
ARG GOVERSION=1.5.2
|
||||||
|
ARG GOARCH=amd64
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y --no-install-recommends ca-certificates wget git
|
||||||
|
|
||||||
|
# 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
|
||||||
|
RUN mkdir -p $GOPATH/src/github.com/restic/restic
|
||||||
|
|
||||||
|
# install tools
|
||||||
|
RUN go get golang.org/x/tools/cmd/cover
|
||||||
|
RUN go get github.com/mattn/goveralls
|
||||||
|
RUN go get github.com/mitchellh/gox
|
||||||
|
|
||||||
|
# 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
|
Loading…
Reference in New Issue
Block a user