forked from device-management-toolkit/rpc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 997 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 997 Bytes
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
#*********************************************************************
# * Copyright (c) Intel Corporation 2021
# * SPDX-License-Identifier: Apache-2.0
# **********************************************************************
FROM golang:1.26-alpine@sha256:2389ebfa5b7f43eeafbd6be0c3700cc46690ef842ad962f6c5bd6be49ed82039 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/v2@v2.0.1
# Generate license files
RUN go-licenses save ./... --save_path=licenses --ignore github.com/alecthomas/kong-yaml
# Build rpc
RUN CGO_ENABLED=0 LDFLAGS="-s -w" GOOS=linux GOARCH=amd64 go build -o /build/rpc ./cmd/rpc/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"]