Skip to content

Commit 6bbe218

Browse files
committed
init
1 parent ad2088a commit 6bbe218

File tree

5 files changed

+760
-0
lines changed

5 files changed

+760
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v3
14+
15+
- name: Generate Docker Metadata
16+
id: meta
17+
uses: docker/metadata-action@v4
18+
with:
19+
images: ghcr.io/${{ github.repository }}
20+
tags: |
21+
type=ref,event=tag
22+
type=semver,pattern={{version}}
23+
type=semver,pattern={{major}}.{{minor}}
24+
flavor: latest=true
25+
26+
- name: Setup Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build and Push Docker Image
37+
uses: docker/build-push-action@v3
38+
env:
39+
DOCKER_BUILDKIT: 1
40+
with:
41+
context: .
42+
file: docker/Dockerfile
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

docker/Dockerfile

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
ARG BASE_IMAGE=debian:12
2+
3+
FROM $BASE_IMAGE
4+
5+
LABEL org.opencontainers.image.source="https://github.com/code-tool/argocd-helmfile-plugin"
6+
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV ARGOCD_USER_ID=999
9+
10+
ARG TARGETPLATFORM
11+
ARG BUILDPLATFORM
12+
13+
RUN echo "I am running on final $BUILDPLATFORM, building for $TARGETPLATFORM"
14+
15+
USER root
16+
17+
RUN apt-get update && apt-get install --no-install-recommends -y \
18+
ca-certificates \
19+
git git-lfs \
20+
wget \
21+
jq && \
22+
apt-get clean && \
23+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
24+
25+
RUN groupadd -g $ARGOCD_USER_ID argocd && \
26+
useradd -r -u $ARGOCD_USER_ID -g argocd argocd && \
27+
mkdir -p /home/argocd && \
28+
chown argocd:0 /home/argocd && \
29+
chmod g=u /home/argocd
30+
31+
# Binary versions
32+
# https://github.com/helm/helm/releases
33+
# Supported Kubernetes Versions 1.32.x - 1.29.x (https://helm.sh/docs/topics/version_skew/)
34+
ARG HELM3_VERSION="v3.17.4"
35+
# https://github.com/helmfile/helmfile/releases
36+
ARG HELMFILE_VERSION="1.1.5"
37+
38+
# https://github.com/getsops/sops/releases
39+
ARG SOPS_VERSION="v3.10.2"
40+
# https://github.com/FiloSottile/age/releases
41+
ARG AGE_VERSION="v1.2.1"
42+
43+
# https://github.com/kubernetes-sigs/kustomize/releases
44+
ARG KUSTOMIZE5_VERSION="5.7.1"
45+
# https://github.com/mikefarah/yq/releases
46+
ARG YQ_VERSION="v4.47.1"
47+
48+
# https://github.com/kubernetes/kubectl/tags
49+
# Compatible with Kubernetes versions ±1 from its version.
50+
ARG KUBECTL_VERSION="v1.32.8"
51+
# https://github.com/kubernetes-sigs/krew/releases/
52+
ARG KREW_VERSION="v0.4.5"
53+
# https://github.com/bitnami-labs/sealed-secrets/releases
54+
ARG KUBESEAL_VERSION="0.30.0"
55+
56+
57+
RUN \
58+
GO_ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/') && \
59+
wget -qO- "https://get.helm.sh/helm-${HELM3_VERSION}-linux-${GO_ARCH}.tar.gz" | tar zxv --strip-components=1 -C /tmp linux-${GO_ARCH}/helm && mv /tmp/helm /usr/local/bin/helm && \
60+
wget -qO "/usr/local/bin/sops" "https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/sops-${SOPS_VERSION}.linux.${GO_ARCH}" && \
61+
wget -qO- "https://github.com/FiloSottile/age/releases/download/${AGE_VERSION}/age-${AGE_VERSION}-linux-${GO_ARCH}.tar.gz" | tar zxv --strip-components=1 -C /usr/local/bin age/age age/age-keygen && \
62+
wget -qO- "https://github.com/helmfile/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION}_linux_${GO_ARCH}.tar.gz" | tar zxv -C /usr/local/bin helmfile && \
63+
wget -qO "/usr/local/bin/yq" "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${GO_ARCH}" && \
64+
wget -qO "/usr/local/bin/kubectl" "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${GO_ARCH}/kubectl" && \
65+
wget -qO- "https://github.com/kubernetes-sigs/krew/releases/download/${KREW_VERSION}/krew-linux_${GO_ARCH}.tar.gz" | tar zxv -C /tmp ./krew-linux_${GO_ARCH} && mv /tmp/krew-linux_${GO_ARCH} /usr/local/bin/kubectl-krew && \
66+
wget -qO- "https://github.com/bitnami-labs/sealed-secrets/releases/download/v${KUBESEAL_VERSION}/kubeseal-${KUBESEAL_VERSION}-linux-${GO_ARCH}.tar.gz" | tar zxv -C /usr/local/bin kubeseal && \
67+
wget -qO- "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE5_VERSION}/kustomize_v${KUSTOMIZE5_VERSION}_linux_${GO_ARCH}.tar.gz" | tar zxv -C /usr/local/bin kustomize && \
68+
true
69+
70+
COPY src/*.sh /usr/local/bin/
71+
72+
RUN \
73+
chown root:root /usr/local/bin/* && chmod 755 /usr/local/bin/*
74+
75+
ENV USER=argocd
76+
USER $ARGOCD_USER_ID
77+
78+
WORKDIR /home/argocd/cmp-server/config/
79+
COPY src/plugin.yaml ./
80+
WORKDIR /home/argocd
81+
82+
# repo-server containers use /helm-working-dir (empty dir volume helm-working-dir)
83+
ENV HELM_CACHE_HOME=/home/argocd/helm/cache
84+
#ENV HELM_CONFIG_HOME=/home/argocd/helm/config
85+
ENV HELM_DATA_HOME=/home/argocd/helm/data
86+
ENV KREW_ROOT=/home/argocd/krew
87+
ENV PATH="${KREW_ROOT}/bin:$PATH"
88+
89+
# plugin versions
90+
# https://github.com/databus23/helm-diff/releases
91+
ARG HELM_DIFF_VERSION="3.12.5"
92+
# https://github.com/aslafy-z/helm-git/releases
93+
ARG HELM_GIT_VERSION="1.4.0"
94+
# https://github.com/jkroepke/helm-secrets/releases
95+
ARG HELM_SECRETS_VERSION="4.6.5"
96+
97+
RUN \
98+
helm plugin install https://github.com/databus23/helm-diff --version ${HELM_DIFF_VERSION} && \
99+
helm plugin install https://github.com/aslafy-z/helm-git --version ${HELM_GIT_VERSION} && \
100+
helm plugin install https://github.com/jkroepke/helm-secrets --version ${HELM_SECRETS_VERSION} && \
101+
kubectl krew update && \
102+
mkdir -p ${KREW_ROOT}/bin && \
103+
true
104+
105+
# array is exec form, string is shell form
106+
# this binary in injected via a shared folder with the repo server
107+
#ENTRYPOINT [/var/run/argocd/argocd-cmp-server]

0 commit comments

Comments
 (0)