Skip to content

Instantly share code, notes, and snippets.

@sedders123
Created March 9, 2022 09:38
Show Gist options
  • Save sedders123/ed0f8a5142446755ffae407db9f0201e to your computer and use it in GitHub Desktop.
Save sedders123/ed0f8a5142446755ffae407db9f0201e to your computer and use it in GitHub Desktop.
This Dockerfile can be used to build an image that Octopus Deploy can use to deploy to EKS using Helm v2
FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive
ARG Aws_Cli_Version=2.0.60
ARG Aws_Iam_Authenticator_Version=0.5.3
ARG Aws_Powershell_Version=4.1.2
ARG Eks_Cli_Version=0.25.0
ARG Helm_Version=v2.17.0
ARG Kubectl_Version=1.18.8-00
ARG Octopus_Cli_Version=7.4.1
ARG Octopus_Client_Version=8.8.3
ARG Powershell_Version=7.0.6*
# Install wget, apt-utils, and software-properties-common
RUN apt-get update && \
apt-get install -y wget unzip apt-utils curl software-properties-common
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && \
add-apt-repository universe && \
apt-get install -y powershell=${Powershell_Version}
RUN apt-get update && \
apt-get install -y --no-install-recommends gnupg curl ca-certificates apt-transport-https && \
curl -sSfL https://apt.octopus.com/public.key | apt-key add - && \
sh -c "echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list" && \
apt-get update && \
apt-get install -y octopuscli=${Octopus_Cli_Version}
RUN pwsh -c 'Install-Package -Force Octopus.Client -MaximumVersion "'${Octopus_Client_Version}'" -source https://www.nuget.org/api/v2 -SkipDependencies' && \
octopusClientPackagePath=$(pwsh -c '(Get-Item ((Get-Package Octopus.Client).source)).Directory.FullName') && \
cp -r $octopusClientPackagePath/lib/netstandard2.0/* .
RUN pwsh -c 'Install-Module -Force -Name AWSPowerShell.NetCore -AllowClobber -Scope AllUsers -MaximumVersion "'${Aws_Powershell_Version}'"'
RUN wget --quiet -O - https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash -s -- -v ${Helm_Version}
RUN wget --quiet -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list && \
apt-get update && apt-get install -y kubectl=${Kubectl_Version}
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${Aws_Cli_Version}.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm awscliv2.zip && \
rm -rf ./aws
RUN curl --silent --location "https://github.com/weaveworks/eksctl/releases/download/${Eks_Cli_Version}/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp && \
mv /tmp/eksctl /usr/local/bin
RUN curl --silent --location https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${Aws_Iam_Authenticator_Version}/aws-iam-authenticator_${Aws_Iam_Authenticator_Version}_linux_amd64 -o /usr/local/bin/aws-iam-authenticator && \
chmod +x /usr/local/bin/aws-iam-authenticator
RUN add-apt-repository -y ppa:rmescandon/yq && \
apt-get update && apt-get install -y jq yq openssh-client rsync git augeas-tools
RUN sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_18.04/Release.key -O- | apt-key add - && \
apt-get update && apt-get install -y skopeo
# Tidy up
RUN apt-get clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment