-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathDockerfile
29 lines (21 loc) · 948 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
#*********************************************************************
# * Copyright (c) Intel Corporation 2021
# * SPDX-License-Identifier: Apache-2.0
# **********************************************************************
FROM golang:1.24-alpine@sha256:5429efb7de864db15bd99b91b67608d52f97945837c7f6f7d1b779f9bfe46281 as builder
RUN apk update && apk upgrade && apk add --no-cache git
WORKDIR /rpc
COPY . .
# Install go-licenses
RUN go install github.com/google/go-licenses@latest
# Generate license files
RUN go-licenses save ./... --save_path=licenses
# Build rpc
RUN CGO_ENABLED=0 LDFLAGS="-s -w" GOOS=linux GOARCH=amd64 go build -o /build/rpc ./cmd/main.go
FROM scratch
LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) Intel Corporation 2021'
COPY --from=builder /build/rpc /rpc
#go-licenses will install when ./build.sh is executed
COPY --from=builder /rpc/licenses /licenses
ENTRYPOINT ["/rpc"]