-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): adjust Dockerfile for goreleaser
- Loading branch information
Showing
2 changed files
with
102 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Stage 1 Build myks | ||
FROM --platform=$BUILDPLATFORM golang:1.21 AS builder | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN go mod download \ | ||
&& go mod verify | ||
|
||
RUN CGO_ENABLED=0 \ | ||
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o myks main.go | ||
|
||
|
||
# Stage 2 Download tools | ||
FROM --platform=$BUILDPLATFORM debian:bookworm AS download-tools | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
# renovate: datasource=github-releases depName=helm/helm | ||
ARG HELM_VERSION=v3.13.3 | ||
# renovate: datasource=github-releases depName=carvel-dev/vendir | ||
ARG VENDIR_VERSION=v0.38.0 | ||
# renovate: datasource=github-releases depName=carvel-dev/ytt | ||
ARG YTT_VERSION=v0.46.3 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
curl \ | ||
unzip | ||
|
||
WORKDIR /tools | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
RUN curl -fsSL \ | ||
https://get.helm.sh/helm-v${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz \ | ||
| tar -xzf - --strip-components=1 ${TARGETOS}-${TARGETARCH}/helm | ||
RUN curl -fsSL \ | ||
https://github.com/vmware-tanzu/carvel-vendir/releases/download/v${VENDIR_VERSION}/vendir-${TARGETOS}-${TARGETARCH} \ | ||
> vendir | ||
RUN curl -fsSL \ | ||
https://github.com/vmware-tanzu/carvel-ytt/releases/download/v${YTT_VERSION}/ytt-${TARGETOS}-${TARGETARCH} \ | ||
> ytt | ||
RUN chmod +x * | ||
|
||
|
||
# Stage 3: Bring it all together | ||
FROM --platform=$BUILDPLATFORM debian:bookworm | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
git \ | ||
gnupg2 \ | ||
ssh \ | ||
tini \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=download-tools /tools/* /usr/local/bin/ | ||
COPY --from=builder /app/myks /usr/local/bin/ | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT ["tini", "--", "myks"] |