Enhance Dockerfile (#869)

- Dockerfile can build gopass
- Reduce gopass Docker image by ~588MiB using multi-stage builds

Fixes #867

Signed-off-by: Andrey Arapov <andrey.arapov@nixaid.com>
This commit is contained in:
Andrey Arapov 2018-06-12 15:36:23 +02:00 committed by Dominik Schulz
parent d32bb13615
commit a571f97b98
2 changed files with 23 additions and 6 deletions

View File

@ -1,14 +1,17 @@
FROM golang:1.10-alpine AS builder
RUN apk add -U make git gnupg
RUN apk add -U make gcc musl-dev ncurses git
ADD . /go/src/github.com/gopasspw/gopass
WORKDIR /go/src/github.com/gopasspw/gopass
RUN make install
RUN TERM=vt100 make install
RUN chown -R 1000:1000 /go/src/github.com/gopasspw/gopass
ENV HOME /go/src/github.com/gopasspw/gopass
FROM alpine:3.7
RUN apk add -U git gnupg
COPY --from=0 /go/src/github.com/gopasspw/gopass /usr/bin/
RUN chown -Rh 1000:1000 -- /root
ENV HOME /root
USER 1000:1000
CMD [ "/go/src/github.com/gopasspw/gopass/gopass" ]
ENTRYPOINT [ "/usr/bin/gopass" ]

View File

@ -58,6 +58,20 @@ For OpenBSD 6.2 and earlier, install via `go get`.
Please note that the OpenBSD builds uses `pledge(2)` to disable some syscalls,
so some features (e.g. version checks, auto-update) are unavailable.
#### Docker
Build it
```
docker build -t gopass github.com/gopasspw/gopass#master
```
Use it
```
alias gopass="docker run --rm -ti -v $HOME:/root gopass"
```
### Set up a GPG key pair
gopass depends on the `gpg` program for encryption and decryption. You **must** have a