aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAli Yousuf <aly.yousuf7@gmail.com>2018-11-03 03:39:19 +0500
committerAli Yousuf <aly.yousuf7@gmail.com>2018-11-03 03:51:31 +0500
commit72c411f5d3de16f0c574ff6045114455142f7964 (patch)
tree734f557b8aee1c80924d036a64af30cca7bb23c4
parent200a8a0ac8814a261464ee5bc57d168521a254ce (diff)
downloadsshtron-72c411f5d3de16f0c574ff6045114455142f7964.tar.gz
Use build-arg to change docker base image
Signed-off-by: Ali Yousuf <aly.yousuf7@gmail.com>
-rw-r--r--Dockerfile11
-rw-r--r--README.md6
2 files changed, 12 insertions, 5 deletions
diff --git a/Dockerfile b/Dockerfile
index 9a8619e..f6fb13c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,15 @@
-FROM golang:latest as builder
+ARG BASE_IMAGE=golang:latest
+FROM $BASE_IMAGE as builder
WORKDIR $GOPATH/src/github.com/zachlatta/sshtron
ADD . .
-RUN go get && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /usr/bin/sshtron .
+# CGO_ENABLED=0 is here to fix this issue:
+# https://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker
+RUN go get && CGO_ENABLED=0 go build -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
+RUN apk add --update openssh-client && \
+ ssh-keygen -t rsa -N "" -f id_rsa
ENTRYPOINT sshtron
diff --git a/README.md b/README.md
index 30625b5..39b0fff 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,11 @@ $ docker build -t sshtron .
$ docker run -t -d -p 2022:2022 --restart always --name sshtron sshtron
```
-For Raspberry Pi, change the base image in `Dockerfile` from `golang:latest` to `resin/raspberry-pi-golang:latest`.
+For Raspberry Pi, use the following to build the Docker image:
+
+```sh
+$ docker build -t sshtron --build-arg BASE_IMAGE=resin/raspberry-pi-golang:latest .
+```
## CVE-2016-0777
Un proyecto texto-plano.xyz