-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (42 loc) · 1.9 KB
/
Dockerfile
File metadata and controls
55 lines (42 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#------ Build golang app ------#
FROM --platform=$BUILDPLATFORM registry.tech.hextech.io/library/golang:1.18.3-alpine3.16 as builder
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
ARG TARGETOS TARGETARCH
# CGO_ENABLED=0 for cross platform build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o argocd-helm-envsubst-plugin
#------ Install dependening software ------#
FROM registry.tech.hextech.io/library/alpine:3.16 as helm-builder
# amd64/arm64
ARG TARGETARCH
WORKDIR /app
RUN apk add --update --no-cache wget git curl
# Install helm
ARG HELM_VERSION=3.10.3
ENV HELM_BASE_URL="https://get.helm.sh"
RUN wget ${HELM_BASE_URL}/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz -O - | tar -xz && \
chmod +x linux-${TARGETARCH}/helm && \
mv linux-${TARGETARCH}/helm /app/helm
# Install kustomize
ARG KUSTOMIZE_VERSION=4.5.7
ENV KUSTOMIZE_BASE_URL="https://github.com/kubernetes-sigs/kustomize/releases/download"
RUN wget ${KUSTOMIZE_BASE_URL}/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_${TARGETARCH}.tar.gz -O - | tar -xz && \
chmod +x kustomize
#------ Final image ------#
FROM registry.tech.hextech.io/library/alpine:3.16
# Used by plugin to create temporary helm repositories.yaml
RUN mkdir /helm-working-dir
RUN chmod 777 /helm-working-dir
# Set default helm cache dir to somewhere we can read write
ENV HELM_CACHE_HOME /helm-working-dir
# This is the required location for argocd to recognize the plugin
# https://argo-cd.readthedocs.io/en/stable/user-guide/config-management-plugins/
COPY ConfigManagementPlugin.yaml /home/argocd/cmp-server/config/plugin.yaml
COPY --from=helm-builder /app/helm /usr/bin/
COPY --from=helm-builder /app/kustomize /usr/bin/
COPY --from=builder /app/argocd-helm-envsubst-plugin /usr/bin/
# Backward compatibility - to be removed
COPY --from=builder /app/argocd-helm-envsubst-plugin /app/argocd-helm-envsubst-plugin