Skip to content

Commit

Permalink
build(docker): adds licensefiles (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
graikhel-intel authored Sep 5, 2024
1 parent fffd060 commit b4b602a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@
# **********************************************************************

FROM golang:1.23-alpine@sha256:d0b31558e6b3e4cc59f6011d79905835108c919143ebecc58f35965bf79948f4 as builder
RUN apk update
RUN apk upgrade
RUN apk add --no-cache git

RUN apk update && apk upgrade && apk add --no-cache git

WORKDIR /rpc
COPY . .
RUN CGO_ENABLED=0 LDFLAGS="-s -w" GOOS=linux GOARCH=amd64 go build -o /build/rpc ./cmd/main.go

# Install go-licenses
RUN go install github.com/google/go-licenses@latest

# Generate license files
RUN go-licenses save ./... --include_tests --save_path=licensefiles

# 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
COPY --from=builder /rpc/licensefiles /licensefiles

ENTRYPOINT ["/rpc"]

0 comments on commit b4b602a

Please sign in to comment.