diff --git a/.goreleaser.yml b/.goreleaser.yml index 32547c9..ed86d19 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -23,13 +23,3 @@ archive: format: zip files: - LICENSE - -dockers: - - - goos: linux - goarch: amd64 - binaries: - - secrethub-http-proxy - image_templates: - - "secrethub/http-proxy:{{ .Version }}" - - "secrethub/http-proxy:latest" diff --git a/Dockerfile b/Dockerfile index f4986ba..1674e38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,20 @@ -FROM alpine +FROM golang:1.12-alpine as build_base +WORKDIR /build +ENV GO111MODULE=on +RUN apk add --update git +COPY go.mod . +COPY go.sum . +RUN go mod download + +FROM build_base as build +RUN apk add --update make +COPY . . +RUN make build -COPY secrethub-http-proxy /usr/bin/secrethub-http-proxy -RUN apk add --no-cache ca-certificates && update-ca-certificates +FROM alpine +COPY --from=build /build/secrethub-http-proxy /usr/bin/secrethub-http-proxy +RUN apk add --no-cache ca-certificates && \ + update-ca-certificates EXPOSE 8080 diff --git a/README.md b/README.md index 0feb36d..9bf3c99 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,18 @@ Get the source code: git clone https://github.com/secrethub/secrethub-http-proxy ``` -Build it using: +To build the binary from source, use: ``` make build ``` +To build the Docker image from scratch, you can use: + +``` +docker build -t secrethub-http-proxy . +``` + [circleci]: https://circleci.com/gh/secrethub/secrethub-http-proxy [discord]: https://discord.gg/NWmxVeb [latest-version]: https://github.com/secrethub/secrethub-http-proxy/releases/latest