Last active
November 30, 2022 09:36
-
-
Save armenr/7323151f74a7fdc29ddf4b9a48cd0781 to your computer and use it in GitHub Desktop.
ArgoCD 2.5.2 + Extras w/ Helmfile (helmfile, helm-diff, helm-secrets)
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
#!/bin/bash | |
set -e -o pipefail | |
################################################################################################## | |
# Multi-arch build script for all Dockerfiles in the repository (amd64 + arm64) | |
# | |
# This script will build all Docker containers defined by the Dockerfiles in this repository. | |
# It enables Docker BuildKit when building containers. | |
# | |
# This script assumes a straightforward directory layout where each image you want to build is | |
# referenced in the "IMAGES" array below. Every image in the array should have a directory of the | |
# same name (which containes a `Dockerfile``) located in the directory where this script resides. | |
# | |
# Example directory layout: | |
# ├── argocd | |
# │ └── Dockerfile | |
# └── nodejs | |
# │ └── Dockerfile | |
# ├── build.sh | |
# | |
# By default, the script pushes to the dockerhub account with which you are logged in on the CLI. | |
# | |
# * Dependencies: | |
# * docker | |
# * docker buildx + buildkit features/experimental settings = enabled | |
# | |
# Usage | |
# $> ./build.sh | |
# | |
################################################################################################## | |
export DOCKER_BUILDKIT=1 | |
DOCKER_TAG=${DOCKER_TAG:-"latest"} | |
DOCKER_REPO=${DOCKER_REPO:-"your-dockerhub-account"} | |
IMAGES=( | |
argocd | |
) | |
for image in "${IMAGES[@]}"; do | |
export IMAGE_NAME="5k_${image}" | |
echo "⏳ Building linux/amd64 & linux/arm64 images for: ${image}:${DOCKER_TAG} ..." | |
docker buildx build "./${image}" \ | |
--platform linux/arm64,linux/amd64 \ | |
--progress=plain \ | |
--cache-to type=inline \ | |
--cache-from type=registry,ref="${DOCKER_REPO}/${IMAGE_NAME}" \ | |
--tag "${DOCKER_REPO}/${IMAGE_NAME}:${DOCKER_TAG}" \ | |
--tag "${DOCKER_REPO}/${IMAGE_NAME}:latest" \ | |
--push | |
echo "🙌 Published ${IMAGE_NAME}:${DOCKER_TAG}" | |
unset IMAGE_NAME | |
done |
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
# syntax=docker/dockerfile:1.4 | |
# follow link regarding ^^: https://hub.docker.com/r/docker/dockerfile | |
################################################################################ | |
# Straightforward ArgoCD + HelmFile Custom Image | |
################################################################################ | |
# This Dockerfile allows us to customize the ArgoCD Docker image with additional tooling | |
# This could be achieved by using a CMP-sidecar, but we'd prefer not to lose hours/days | |
# fiddling with Argo's as-yet clumsy-feeling plugin sidecar + cmp support. | |
# | |
# See link for docs on alternative method, and decide for yourself... | |
# https://argo-cd.readthedocs.io/en/stable/use-guide/config-management-plugins/#configure-plugin-via-sidecar | |
ARG ARGOCD_VERSION="v2.5.3" | |
FROM argoproj/argocd:$ARGOCD_VERSION as argo-patched | |
ENV DEBIAN_FRONTEND=noninteractive | |
ENV DEBCONF_FRONTEND=noninteractive | |
USER root | |
# Download OS dependencies | |
RUN <<EOF | |
apt-get update | |
apt-get install -y \ | |
curl \ | |
git \ | |
wget \ | |
unzip | |
apt-get -y autoremove | |
apt-get -y clean | |
EOF | |
ENV HELM_PLUGINS="/opt/helm/plugins/" | |
ARG HELM_DIFF_VERSION="3.6.0" | |
RUN helm plugin install https://github.com/databus23/helm-diff --version ${HELM_DIFF_VERSION} | |
ARG HELM_SECRETS_VERSION="4.2.2" | |
RUN helm plugin install https://github.com/jkroepke/helm-secrets --version ${HELM_SECRETS_VERSION} | |
ARG HELM_GIT_VERSION="0.14.0" | |
RUN helm plugin install https://github.com/aslafy-z/helm-git.git --version ${HELM_GIT_VERSION} | |
ENV HELM_PLUGINS="/opt/helm/plugins/" | |
USER 999 | |
## Final builder | |
FROM argo-patched as final | |
# Version-specific | |
COPY --from=bitnami/kubectl:1.25.4 --link /opt/bitnami/kubectl/bin/kubectl /usr/bin/kubectl | |
# Gimme the latest... | |
COPY --from=hairyhenderson/gomplate:latest --link /gomplate /usr/bin/gomplate | |
COPY --from=chatwork/helmfile:latest --link /usr/local/bin/helmfile /usr/bin/helmfile | |
COPY --from=mikefarah/yq:latest --link /usr/bin/yq /usr/bin/yq | |
COPY --from=mozilla/sops:alpine --link /usr/local/bin/sops /usr/bin/sops | |
ENV HELM_PLUGINS="/opt/helm/plugins/" | |
USER 999 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment