-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Multi stage build for sdk image for powermax (#34)
* Implement docker multi stage build * Fixed the lint issue * Implement docker multi stage build * Fixed the lint issue
- Loading branch information
1 parent
847285b
commit 1c3cedc
Showing
5 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ vendor/ | |
cmd/*/bin/ | ||
**/.vscode/ | ||
**/.idea/ | ||
|
||
csm-common.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
ARG BASEIMAGE | ||
|
||
# Build the sdk binary | ||
FROM golang:1.21 as builder | ||
|
||
# Set envirment variable | ||
ENV APP_NAME csm-metrics-powermax | ||
ENV CMD_PATH cmd/metrics-powermax/main.go | ||
|
||
# Copy application data into image | ||
COPY . /go/src/$APP_NAME | ||
WORKDIR /go/src/$APP_NAME | ||
|
||
# Build the binary | ||
RUN go install github.com/golang/mock/[email protected] | ||
RUN go generate ./... | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/src/service /go/src/$APP_NAME/$CMD_PATH | ||
|
||
# Build the sdk image | ||
FROM $BASEIMAGE as final | ||
LABEL vendor="Dell Inc." \ | ||
name="csm-metrics-powermax" \ | ||
summary="Dell Container Storage Modules (CSM) for Observability - Metrics for PowerMax" \ | ||
description="Provides insight into storage usage and performance as it relates to the CSI (Container Storage Interface) Driver for Dell PowerMax" \ | ||
version="2.0.0" \ | ||
license="Apache-2.0" | ||
ARG SERVICE | ||
COPY $SERVICE/bin/service /service | ||
ENTRYPOINT ["/service"] | ||
|
||
COPY --from=builder /go/src/service / | ||
ENTRYPOINT ["/service"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters