diff options
author | Jay MOULIN <jaymoulin@gmail.com> | 2018-01-02 21:03:46 +0100 |
---|---|---|
committer | Jay MOULIN <jaymoulin@gmail.com> | 2018-01-02 21:36:10 +0100 |
commit | 1f2fd1b48e4c11ab7f4c3cd5bd369c23bf56d112 (patch) | |
tree | 403a28d3077b65f89c5f64f7b624aee02a1d9992 | |
parent | bb2e5e71ae17adb1c04d5dc077f1525c8622ec17 (diff) | |
download | sshtron-1f2fd1b48e4c11ab7f4c3cd5bd369c23bf56d112.tar.gz |
Docker with builder - reduce image size
-rw-r--r-- | Dockerfile | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1,11 +1,12 @@ -FROM golang:latest +FROM golang:latest as builder WORKDIR $GOPATH/src/github.com/zachlatta/sshtron - -RUN apt-get update && apt-get install openssh-client && \ - ssh-keygen -t rsa -N "" -f id_rsa - ADD . . -RUN go get && go install +RUN go get && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /usr/bin/sshtron . +FROM alpine:latest + +COPY --from=builder /usr/bin/sshtron /usr/bin/ +RUN apk add --update --no-cache openssh-client && \ + ssh-keygen -t rsa -N "" -f id_rsa ENTRYPOINT sshtron |