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

Commit 8a0a440

Browse files
Merge pull request #21 from secrethub/feature/dockerfile
Build the binary in the Dockerfile
2 parents da9bba6 + 5af197f commit 8a0a440

3 files changed

Lines changed: 23 additions & 14 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

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ Get the source code:
107107
git clone https://github.com/secrethub/secrethub-http-proxy
108108
```
109109

110-
Build it using:
110+
To build the binary from source, use:
111111

112112
```
113113
make build
114114
```
115115

116+
To build the Docker image from scratch, you can use:
117+
118+
```
119+
docker build -t secrethub-http-proxy .
120+
```
121+
116122
[circleci]: https://circleci.com/gh/secrethub/secrethub-http-proxy
117123
[discord]: https://discord.gg/NWmxVeb
118124
[latest-version]: https://github.com/secrethub/secrethub-http-proxy/releases/latest

0 commit comments

Comments
 (0)