diff options
| -rw-r--r-- | .dockerignore | 3 | ||||
| -rw-r--r-- | Dockerfile | 13 | ||||
| -rw-r--r-- | Makefile | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5ce33ff --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +/build +/Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4052183 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.12-alpine as builder +WORKDIR /app +COPY . /app +RUN apk add --no-cache git make \ + && make linux-amd64 + +# Runtime +FROM scratch +COPY --from=builder /app/build/tarpit-linux-amd64 /tarpit +USER 65534:65534 +EXPOSE 2022 +ENTRYPOINT ["/tarpit"] +CMD ["-p", "2022"] @@ -5,7 +5,7 @@ linux-amd64: build/tarpit-linux-amd64 windows-amd64: build/tarpit-windows-amd64.exe build/tarpit-linux-amd64: $(SRC) - GOOS=linux GOARCH=amd64 go build -o "$@" + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o "$@" -ldflags '-extldflags "-static"' build/tarpit-windows-amd64.exe: $(SRC) GOOS=windows GOARCH=amd64 go build -o "$@" |
