Skip to content

Commit

Permalink
Build a docker container
Browse files Browse the repository at this point in the history
The build phase makes the assumption that any capnproto-files
are pre-processed before building in-docker.
  • Loading branch information
Johan Bergström committed Apr 30, 2019
1 parent 137928e commit 1deec64
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
@@ -0,0 +1,17 @@
FROM golang:1.12-alpine as builder

WORKDIR /go/src/github.com/cloudflare/cloudflared/
COPY . .

RUN apk add --no-cache gcc musl-dev git upx ca-certificates
RUN VERSION=$(git describe --tags --always --dirty="-dev") && \
DATE=$(date -u '+%Y-%m-%dT%H:%MZ') && \
go build -ldflags "-X main.Version=\"${VERSION}\" -X main.BuildTime=\"${DATE}\"" \
-installsuffix cgo -o cloudflared ./cmd/cloudflared
RUN upx --no-progress cloudflared

FROM alpine:3.9
COPY --from=builder /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENTRYPOINT ["cloudflared"]
CMD ["version"]
4 changes: 4 additions & 0 deletions Makefile
Expand Up @@ -31,6 +31,10 @@ clean:
cloudflared: tunnel-deps
go build -v $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared

.PHONY: container
container:
docker build -t cloudflare/cloudflared:"$(VERSION)" .

.PHONY: test
test: vet
go test -v -race $(VERSION_FLAGS) ./...
Expand Down

0 comments on commit 1deec64

Please sign in to comment.