-
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.
Merge pull request #64 from mykso/add_docker_image
feat: Added docker image
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Stage 1 Build myks | ||
FROM golang:1.20 AS builder | ||
COPY . /app | ||
WORKDIR /app | ||
RUN go mod download && \ | ||
go mod verify | ||
RUN CGO_ENABLED=0 \ | ||
go build -trimpath -o myks main.go | ||
|
||
# Stage 2 Download tools | ||
FROM debian:bookworm AS download-tools | ||
ARG HELM_VERSION=3.11.2 | ||
ARG VENDIR_VERSION=0.33.1 | ||
ARG YTT_VERSION=0.45.0 | ||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
curl \ | ||
unzip | ||
ENV TOOLS_ROOT=/tools | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN mkdir ${TOOLS_ROOT} && \ | ||
curl -fsSL \ | ||
https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | \ | ||
tar -xzf - -C ${TOOLS_ROOT} --strip-components=1 linux-amd64/helm && \ | ||
curl -fsSL \ | ||
https://github.com/vmware-tanzu/carvel-vendir/releases/download/v${VENDIR_VERSION}/vendir-linux-amd64 \ | ||
> ${TOOLS_ROOT}/vendir && \ | ||
curl -fsSL \ | ||
https://github.com/vmware-tanzu/carvel-ytt/releases/download/v${YTT_VERSION}/ytt-linux-amd64 \ | ||
> ${TOOLS_ROOT}/ytt | ||
RUN chmod +x ${TOOLS_ROOT}/* | ||
|
||
# Stage 3: Bring it all together | ||
FROM debian:bookworm | ||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
ca-certificates \ | ||
git \ | ||
gnupg2 \ | ||
ssh \ | ||
tini && \ | ||
rm -rf /var/lib/apt/lists/* | ||
ENV TOOLS_ROOT=/tools | ||
WORKDIR /app | ||
ENV PATH="${PATH}:${TOOLS_ROOT}" | ||
COPY --from=download-tools ${TOOLS_ROOT} ${TOOLS_ROOT} | ||
COPY --from=builder app/myks ${TOOLS_ROOT} | ||
ENTRYPOINT ["tini", "--", "myks"] |