From 9e23345df9cbb0c14f5ed43cb09e4c177c8a9049 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Wed, 25 Jan 2023 12:54:22 +0100 Subject: [PATCH] WIP --- .dockerignore | 1 + Dockerfile | 11 +++++++++++ Dockerfile-helmfile | 16 ++++++++++++++++ Makefile | 2 ++ dockerfiles/Dockerfile-argo-arm64 | 0 dockerfiles/Dockerfile-argo-x86_64 | 0 dockerfiles/Dockerfile-full-arm64 | 0 dockerfiles/Dockerfile-full-x86_64 | 0 dockerfiles/Dockerfile-helmfile | 16 ++++++++++++++++ dockerfiles/Dockerfile-helmfile-arm64 | 0 dockerfiles/Dockerfile-helmfile-x86_64 | 0 scripts/download_for_arch.sh | 15 +++++++++++++++ 12 files changed, 61 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Dockerfile-helmfile create mode 100644 Makefile create mode 100644 dockerfiles/Dockerfile-argo-arm64 create mode 100644 dockerfiles/Dockerfile-argo-x86_64 create mode 100644 dockerfiles/Dockerfile-full-arm64 create mode 100644 dockerfiles/Dockerfile-full-x86_64 create mode 100644 dockerfiles/Dockerfile-helmfile create mode 100644 dockerfiles/Dockerfile-helmfile-arm64 create mode 100644 dockerfiles/Dockerfile-helmfile-x86_64 create mode 100755 scripts/download_for_arch.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5a441c6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM rust:1.66.1-alpine3.17 as builder +WORKDIR /src +RUN apk update && apk add --no-cache gcc musl-dev +COPY ./ . +RUN cargo build --release + + +FROM alpine:3.17.1 +COPY --from=builder /src/target/release/cdh /bin/cdh +WORKDIR /workdir +ENTRYPOINT ["/bin/cdh"] diff --git a/Dockerfile-helmfile b/Dockerfile-helmfile new file mode 100644 index 0000000..8ab352c --- /dev/null +++ b/Dockerfile-helmfile @@ -0,0 +1,16 @@ +FROM alpine:3.17.1 +ARG HELM_VERSION=3.10.3 +ARG HELMFILE_VERSION=0.150.0 + +ARG HELM_LINK=https://get.helm.sh/helm-v$HELM_VERSION-linux-$PLATFORM.tar.gz +ARG HELMFILE_LINK=https://github.com/helmfile/helmfile/releases/download/v$HELMFILE_VERSION/helmfile_$HELMFILE_VERSION_linux_\$PLATFORM.tar.gz + +RUN apk update && apk add --no-cache curl +COPY ./scripts /tmp +RUN echo "installing helm from ${HELM_LINK}" +ENV HELM_ARCHIVE_PATH=/tmp/helm.tar.gz +RUN /tmp/download_for_arch.sh $HELM_LINK $HELM_ARCHIVE_PATH +RUN tar -zxvf $HELM_ARCHIVE_PATH +RUN echo $HELMFILE_LINK + +CMD ["sh"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..acf3e73 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +build: + cargo build --release diff --git a/dockerfiles/Dockerfile-argo-arm64 b/dockerfiles/Dockerfile-argo-arm64 new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/Dockerfile-argo-x86_64 b/dockerfiles/Dockerfile-argo-x86_64 new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/Dockerfile-full-arm64 b/dockerfiles/Dockerfile-full-arm64 new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/Dockerfile-full-x86_64 b/dockerfiles/Dockerfile-full-x86_64 new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/Dockerfile-helmfile b/dockerfiles/Dockerfile-helmfile new file mode 100644 index 0000000..5995d67 --- /dev/null +++ b/dockerfiles/Dockerfile-helmfile @@ -0,0 +1,16 @@ +FROM alpine:3.17.1 +ARG HELM_VERSION=3.10.3 +ARG HELMFILE_VERSION=0.150.0 + +ARG HELM_LINK=https://get.helm.sh/helm-v$HELM_VERSION-linux-\$PLATFORM.tar.gz +ARG HELMFILE_LINK=https://github.com/helmfile/helmfile/releases/download/v$HELMFILE_VERSION/helmfile_$HELMFILE_VERSION_linux_\$PLATFORM.tar.gz + +RUN apk update && apk add --no-cache curl + +RUN echo "installing helm from ${HELM_LINK}" +ENV HELM_ARCHIVE_PATH=/tmp/helm.tar.gz +RUN curl -LJO $HELM $HELM_ARCHIVE_PATH +RUN tar -zxvf $HELM_ARCHIVE_PATH +RUN echo $HELMFILE_LINK + +CMD ["sh"] diff --git a/dockerfiles/Dockerfile-helmfile-arm64 b/dockerfiles/Dockerfile-helmfile-arm64 new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/Dockerfile-helmfile-x86_64 b/dockerfiles/Dockerfile-helmfile-x86_64 new file mode 100644 index 0000000..e69de29 diff --git a/scripts/download_for_arch.sh b/scripts/download_for_arch.sh new file mode 100755 index 0000000..09287e9 --- /dev/null +++ b/scripts/download_for_arch.sh @@ -0,0 +1,15 @@ +#!/bin/sh +case $(uname -m) in + "arm64"|"aarch64") + PLATFORM="arm64" + ;; + "x86_64") + PLATFORM="amd64" + ;; + *) + echo "Unsuported target" + exit 1 + ;; +esac +echo "Downloading $2 from $1" +curl -LJO $1 $2