Build a docker container
Use debian/distroless (glibc) as a base which in general gives slightly higher performance than alpine (musl) while trading off container size (about 10mb). The build phase makes the assumption that any capnproto-files are pre-processed before building in-docker.
This commit is contained in:
parent
acd17f6ab6
commit
d3f9aa2ae7
|
@ -0,0 +1,12 @@
|
||||||
|
FROM golang:1.12 as builder
|
||||||
|
WORKDIR /go/src/github.com/cloudflare/cloudflared/
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends upx
|
||||||
|
# Run after `apt-get update` to improve rebuild scenarios
|
||||||
|
COPY . .
|
||||||
|
RUN make cloudflared
|
||||||
|
RUN upx --no-progress cloudflared
|
||||||
|
|
||||||
|
FROM gcr.io/distroless/base
|
||||||
|
COPY --from=builder /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
|
||||||
|
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
|
||||||
|
CMD ["version"]
|
4
Makefile
4
Makefile
|
@ -31,6 +31,10 @@ clean:
|
||||||
cloudflared: tunnel-deps
|
cloudflared: tunnel-deps
|
||||||
go build -v $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared
|
go build -v $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared
|
||||||
|
|
||||||
|
.PHONY: container
|
||||||
|
container:
|
||||||
|
docker build -t cloudflare/cloudflared:"$(VERSION)" .
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: vet
|
test: vet
|
||||||
go test -v -race $(VERSION_FLAGS) ./...
|
go test -v -race $(VERSION_FLAGS) ./...
|
||||||
|
|
Loading…
Reference in New Issue