forked from sassoftware/viya4-deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (52 loc) · 2.73 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
# syntax=docker/dockerfile:experimental
FROM ubuntu:22.04 as baseline
RUN apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends -y python3 python3-dev python3-pip curl unzip apt-transport-https ca-certificates gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
FROM baseline as tool_builder
ARG kubectl_version=1.28.7
WORKDIR /build
RUN curl -sLO https://storage.googleapis.com/kubernetes-release/release/v$kubectl_version/bin/linux/amd64/kubectl && chmod 755 ./kubectl
# Installation
FROM baseline
ARG helm_version=3.14.2
ARG aws_cli_version=2.15.22
ARG gcp_cli_version=472.0.0-0
# Add extra packages
RUN apt-get update && apt-get install --no-install-recommends -y gzip wget git jq ssh sshpass skopeo rsync \
&& rm -f /etc/ssh/ssh_host_rsa_key && rm -f /etc/ssh/ssh_host_ecdsa_key && rm -f /etc/ssh/ssh_host_ed25519_key \
&& curl -ksLO https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 755 get-helm-3 \
&& ./get-helm-3 --version v$helm_version --no-sudo \
# AWS
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${aws_cli_version}.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
# AZURE
&& curl -sL https://aka.ms/InstallAzureCLIDeb | bash \
# GCP
&& echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \
&& apt-get update && apt-get install --no-install-recommends -y google-cloud-cli:amd64=${gcp_cli_version} \
&& apt-get install --no-install-recommends -y google-cloud-sdk-gke-gcloud-auth-plugin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=tool_builder /build/kubectl /usr/local/bin/kubectl
WORKDIR /viya4-deployment/
COPY . /viya4-deployment/
ENV HOME=/viya4-deployment
RUN pip install -r ./requirements.txt \
&& ansible-galaxy install -r ./requirements.yaml \
&& rm -rf /usr/local/lib/python3.10/dist-packages/ansible_collections/infinidat \
&& rm -rf /usr/local/lib/python3.10/dist-packages/ansible_collections/netbox \
&& pip cache purge \
&& chmod -R g=u /etc/passwd /etc/group /viya4-deployment/ \
&& chmod 755 /viya4-deployment/docker-entrypoint.sh \
&& git config --system --add safe.directory /viya4-deployment
ENV PLAYBOOK=playbook.yaml
ENV VIYA4_DEPLOYMENT_TOOLING=docker
ENV ANSIBLE_CONFIG=/viya4-deployment/ansible.cfg
VOLUME ["/data", "/config", "/vault"]
ENTRYPOINT ["/viya4-deployment/docker-entrypoint.sh"]