forked from uc-cdis/cohort-middleware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (23 loc) · 992 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
ARG AZLINUX_BASE_VERSION=master
#FROM 707767160287.dkr.ecr.us-east-1.amazonaws.com/gen3/golang-build-base:${AZLINUX_BASE_VERSION} as base
FROM --platform=$BUILDPLATFORM quay.io/cdis/golang-build-base:${AZLINUX_BASE_VERSION} AS base
ARG TARGETOS
ARG TARGETARCH
ENV appname=cohort-middleware
ENV CGO_ENABLED=0
ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
FROM base AS builder
WORKDIR $GOPATH/src/github.com/uc-cdis/cohort-middleware/
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN GITCOMMIT=$(git rev-parse HEAD) \
GITVERSION=$(git describe --always --tags) \
&& go build \
-ldflags="-X 'github.com/uc-cdis/cohort-middleware/version.GitCommit=${GITCOMMIT}' -X 'github.com/uc-cdis/cohort-middleware/version.GitVersion=${GITVERSION}'" \
-o /cohort-middleware
FROM scratch
COPY --from=builder /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /cohort-middleware /cohort-middleware
CMD ["/cohort-middleware"]