-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change name from pluralctl to plrlctl (#547)
* change name from pluralctl to plrlctl * update GoReleaser * add plrctl Dockerfile * fix
- Loading branch information
Showing
5 changed files
with
115 additions
and
23 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
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM ubuntu:22.10 AS user | ||
|
||
# Create a nonroot user for final image | ||
RUN useradd -u 10001 nonroot | ||
|
||
FROM golang:1.22-alpine3.19 AS builder | ||
|
||
WORKDIR /workspace | ||
|
||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY cmd/ cmd/ | ||
COPY pkg/ pkg/ | ||
|
||
# Build | ||
ARG APP_VSN | ||
ARG APP_COMMIT | ||
ARG APP_DATE | ||
ARG TARGETARCH | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \ | ||
go build -ldflags '-s -w \ | ||
-X "github.com/pluralsh/plural-cli/pkg/common.Version=${APP_VSN}" \ | ||
-X "github.com/pluralsh/plural-cli/pkg/common.Commit=${APP_COMMIT}" \ | ||
-X "github.com/pluralsh/plural-cli/pkg/common.Date=${APP_DATE}"' \ | ||
-o plrlctl ./cmd/plrlctl | ||
|
||
FROM golang:1.22-alpine3.19 AS final | ||
|
||
WORKDIR / | ||
|
||
RUN apk update && apk add --no-cache git build-base | ||
|
||
# Copy nonroot user and switch to it | ||
COPY --from=user /etc/passwd /etc/passwd | ||
USER nonroot | ||
|
||
COPY --chown=nonroot --from=builder /workspace/plrlctl /go/bin/ | ||
RUN chmod a+x /go/bin/plrlctl | ||
|
||
ENTRYPOINT ["/go/bin/plrlctl"] |