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

Commit e9961ac

Browse files
committed
Build the binary in the Dockerfile
This makes the Dockerfile stand-alone instead of depending on goreleaser to create the binary. You can now build the image with "go build .".
1 parent 605aace commit e9961ac

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

.goreleaser.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,3 @@ archive:
2323
format: zip
2424
files:
2525
- LICENSE
26-
27-
dockers:
28-
-
29-
goos: linux
30-
goarch: amd64
31-
binaries:
32-
- secrethub-http-proxy
33-
image_templates:
34-
- "secrethub/http-proxy:{{ .Version }}"
35-
- "secrethub/http-proxy:latest"

Dockerfile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1-
FROM alpine
1+
FROM golang:1.12-alpine as build_base
2+
WORKDIR /build
3+
ENV GO111MODULE=on
4+
RUN apk add --update git
5+
COPY go.mod .
6+
COPY go.sum .
7+
RUN go mod download
8+
9+
FROM build_base as build
10+
RUN apk add --update make
11+
COPY . .
12+
RUN make build
213

3-
COPY secrethub-http-proxy /usr/bin/secrethub-http-proxy
4-
RUN apk add --no-cache ca-certificates && update-ca-certificates
14+
FROM alpine
15+
COPY --from=build /build/secrethub-http-proxy /usr/bin/secrethub-http-proxy
16+
RUN apk add --no-cache ca-certificates && \
17+
update-ca-certificates
518

619
EXPOSE 8080
720

0 commit comments

Comments
 (0)