| FROM golang:1.16.0-alpine3.12 |
| |
| ARG PROJECT |
| ARG GO_MODULE |
| |
| ENV \ |
| CACHE_BASE=/cache/$PROJECT \ |
| GO111MODULE=on \ |
| GOPRIVATE=$GO_MODULE \ |
| GOPATH=/cache/$PROJECT/Linux/x86_64/go \ |
| GOBIN=/cache/$PROJECT/Linux/x86_64/gobin \ |
| PATH=/cache/$PROJECT/Linux/x86_64/gobin:/cache/$PROJECT/Linux/x86_64/bin:${PATH} |
| |
| WORKDIR /workspace |
| |
| RUN apk add --update --no-cache \ |
| bash \ |
| build-base \ |
| ca-certificates \ |
| curl \ |
| git \ |
| openssh-client \ |
| unzip \ |
| wget && \ |
| rm -rf /var/cache/apk/* |
| |
| RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ |
| wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk && \ |
| apk add --no-cache glibc-2.31-r0.apk && \ |
| rm -rf /var/cache/apk/* |
| |
| COPY go.mod go.sum /workspace/ |
| # This replaces go mod download so that we only download what we need |
| # https://github.com/golang/go/issues/18387 |
| RUN go list -test all |
| COPY make /workspace/make |
| COPY Makefile /workspace/ |
| RUN make dockerdeps |