-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
97 lines (82 loc) · 3.42 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
88
89
90
91
92
93
94
95
96
97
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/aspnet:9.0.1-noble
LABEL org.opencontainers.image.source=https://github.com/gitfool/Pulumi.Dungeon
# Install packages
RUN <<EOF
set -ex
apt-get update
apt-get install --no-install-recommends -y bash-completion curl sudo vim
rm -rf /var/lib/apt/lists/*
mkdir -p /etc/bash_completion.d
EOF
# Install kubectl; https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-kubectl-binary-with-curl-on-linux
# renovate: datasource=github-tags depName=kubectl packageName=kubernetes/kubectl extractVersion=^kubernetes-(?<version>.+)$
RUN <<EOF
set -ex
version=1.32.1
curl -fsSL https://dl.k8s.io/release/v$version/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl
kubectl completion bash > /etc/bash_completion.d/kubectl
kubectl version --client
EOF
# Install aws iam authenticator
# renovate: datasource=github-releases depName=aws-iam-authenticator packageName=kubernetes-sigs/aws-iam-authenticator
RUN <<EOF
set -ex
version=0.6.30
curl -fsSL https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v$version/aws-iam-authenticator_${version}_linux_amd64 -o /usr/local/bin/aws-iam-authenticator
chmod +x /usr/local/bin/aws-iam-authenticator
aws-iam-authenticator version
EOF
# Install helm; https://helm.sh/docs/intro/install/#from-the-binary-releases
# renovate: datasource=github-releases depName=helm packageName=helm/helm
RUN <<EOF
set -ex
version=3.17.0
curl -fsSL https://get.helm.sh/helm-v$version-linux-amd64.tar.gz -o helm.tar.gz
tar -xzf helm.tar.gz --directory /usr/local/bin --no-same-owner --strip=1 linux-amd64/helm
rm -f helm.tar.gz
helm completion bash > /etc/bash_completion.d/helm
helm version --short
EOF
# Install pulumi; https://www.pulumi.com/docs/get-started/install/#manual-installation
ENV PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK=true \
PULUMI_EXPERIMENTAL=true \
PULUMI_SKIP_UPDATE_CHECK=true
# renovate: datasource=github-releases depName=pulumi packageName=pulumi/pulumi
RUN <<EOF
set -ex
version=3.155.0
curl -fsSL https://get.pulumi.com/releases/sdk/pulumi-v$version-linux-x64.tar.gz -o pulumi.tar.gz
tar -xzf pulumi.tar.gz --directory /usr/local/bin --no-same-owner --strip=1 pulumi/pulumi
rm -f pulumi.tar.gz
pulumi gen-completion bash > /etc/bash_completion.d/pulumi
pulumi version
EOF
# Modify non-root user
RUN <<EOF
set -ex
echo "ubuntu ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu
chmod 0440 /etc/sudoers.d/ubuntu
EOF
USER ubuntu
RUN <<EOF
set -ex
echo "alias k='kubectl'\ncomplete -o default -F __start_kubectl k" >> ~/.bash_aliases
echo "alias p='pulumi'\ncomplete -o default -F __start_pulumi p" >> ~/.bash_aliases
echo "alias l='ls -aF'" >> ~/.bash_aliases
echo "alias ll='ls -ahlF'" >> ~/.bash_aliases
echo "alias ls='ls --color=auto --group-directories-first'" >> ~/.bash_aliases
helm repo add stable https://charts.helm.sh/stable
helm repo update
EOF
# Install dungeon
ENV DOTNET_HostBuilder__ReloadConfigOnChange=false
WORKDIR /home/ubuntu/dungeon
COPY --link --chown=1000:1000 bin/Release/publish .
RUN <<EOF
set -ex
echo "alias d='cd ~/dungeon && dotnet pulumi-dungeon.dll'" >> ~/.bash_aliases
find . -type f -regextype posix-egrep -iregex '.*\.(dll|json|yaml)$' -exec chmod -x {} \;
EOF
ENTRYPOINT [ "dotnet", "pulumi-dungeon.dll" ]