Fix Docker build failure (#149)

* Enables module-mode in Docker to fix build

* Statically compile binary in Docker to fix missing dependency errors

* Ensure target OS is set to Linux for Docker builds
This commit is contained in:
Khaled Elkhawaga 2019-11-22 17:27:28 +01:00 committed by Silver
parent 23e12cf5a3
commit dd614881b6
1 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,7 @@
FROM golang:1.12 as builder FROM golang:1.12 as builder
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux
WORKDIR /go/src/github.com/cloudflare/cloudflared/ WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN apt-get update && apt-get install -y --no-install-recommends upx RUN apt-get update && apt-get install -y --no-install-recommends upx
# Run after `apt-get update` to improve rebuild scenarios # Run after `apt-get update` to improve rebuild scenarios