-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
87 lines (62 loc) · 3.04 KB
/
Dockerfile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# syntax=docker/dockerfile:1
ARG ansible_base_version
FROM cytopia/ansible:${ansible_base_version} AS base
RUN apk add --update --no-cache git openssh curl ca-certificates make
# ----------------------------------------------------------------------------------------------------------------------------------
# helm
# ----------------------------------------------------------------------------------------------------------------------------------
FROM base AS helm_builder
ARG helm_version
ARG BASE_URL="https://get.helm.sh"
ARG TAR_FILE="helm-v${helm_version}-linux-amd64.tar.gz"
RUN curl -L ${BASE_URL}/${TAR_FILE} |tar xvz && \
mv linux-amd64/helm /usr/bin/helm && \
chmod +x /usr/bin/helm && \
rm -rf linux-amd64 && \
helm version
RUN helm plugin install https:/chartmuseum/helm-push.git
# ----------------------------------------------------------------------------------------------------------------------------------
# kustomize
# ----------------------------------------------------------------------------------------------------------------------------------
FROM base AS kustomize_builder
ARG KUSTOMIZE_VER="4.1.2"
ARG KUSTOMIZE_URL="https:/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VER}/kustomize_v${KUSTOMIZE_VER}_linux_amd64.tar.gz"
RUN curl -L "${KUSTOMIZE_URL}" |tar xvz \
&& mv kustomize /usr/bin/kustomize \
&& chmod +x /usr/bin/kustomize \
&& kustomize version
# ----------------------------------------------------------------------------------------------------------------------------------
# Main
# ----------------------------------------------------------------------------------------------------------------------------------
FROM base
RUN pip3 install pygments jsonschema boto3
ENV ANSIBLE_COLLECTIONS_PATHS /opt/keployr
ARG cidre_version
ARG keployr_version
##
# Install ansible collections
##
RUN ansible-galaxy collection install \
community.general \
community.kubernetes \
community.aws:==3.2.1 \
ebuildy.cidre:==${cidre_version} \
ebuildy.keployr:==${keployr_version} \
-vvv
ENV ANSIBLE_ROLES_PATH ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
ENV INJECT_FACTS_AS_VARS False
ENV LOCALHOST_WARNING False
ENV KEPLOYR_HOME /opt/keployr/app
ENV ANSIBLE_CONFIG $KEPLOYR_HOME/ansible.cfg
ENV PATH $PATH:$KEPLOYR_HOME/bin
COPY --from=helm_builder /usr/bin/helm /usr/bin/helm
COPY --from=helm_builder /root/.local/share/helm/plugins /home/ansible/.local/share/helm/plugins
COPY --from=helm_builder /root/.local/share/helm/plugins /root/.local/share/helm/plugins
COPY --from=kustomize_builder /usr/bin/kustomize /usr/bin/kustomize
RUN rm -rf \
/usr/share/doc/ \
/usr/share/man/ \
/usr/share/locale/ \
/var/cache/apk/*
ADD app $KEPLOYR_HOME
WORKDIR $KEPLOYR_HOME