Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Build the binary in the Dockerfile
Browse files Browse the repository at this point in the history
This makes the Dockerfile stand-alone instead of depending on
goreleaser to create the binary. You can now build the image with
"go build .".
  • Loading branch information
SimonBarendse committed Apr 30, 2019
1 parent 605aace commit e9961ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
10 changes: 0 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit e9961ac

Please sign in to comment.