add docker image

This commit is contained in:
Bruno Clermont 2017-06-23 10:26:51 +02:00
parent 144b7f3386
commit b7251dbea5
3 changed files with 40 additions and 0 deletions

5
docker/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM alpine:3.6
COPY restic /usr/bin
ENTRYPOINT ["/usr/bin/restic"]

24
docker/README.md Normal file
View File

@ -0,0 +1,24 @@
# Docker image
## Build
From the root of this repository run:
```
./docker/build.sh
```
image name will be `restic/restic:latest`
## Run
Set environment variable `RESTIC_REPOSITORY` and map volume to directories and
files like:
```
docker run --rm -ti \
-v $HOME/.restic/passfile:/pass \
-v $HOME/importantdirectory:/data \
-e RESTIC_REPOSITORY=rest:https://user:pass@hostname/ \
restic/restic -p /pass backup /data
```

11
docker/build.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
echo "Build binary using golang docker image"
docker run --rm -ti \
-v `pwd`:/go/src/github.com/restic/restic \
-w /go/src/github.com/restic/restic golang:1.8.3-alpine go run build.go
echo "Build docker image restic/restic:latest"
docker build --rm -t restic/restic:latest -f docker/Dockerfile .