-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
134 lines (129 loc) · 4.93 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
FROM python:3.9-alpine
ENV TIMEZONE=${TIMEZONE:-Europe/Berlin} \
LANG=${LANGUAGE:-de_DE}.${ENCODING:-UTF-8} \
LANGUAGE=${LANGUAGE:-de_DE}.${ENCODING:-UTF-8} \
LC_ALL=${LANGUAGE:-de_DE}.${ENCODING:-UTF-8}
WORKDIR /srv
COPY python.pkgs /usr/local/share/pip/compile.pkgs
RUN set -eux; \
# Install permanent system packages
apk --update add --no-cache \
coreutils \
curl \
wget \
bash \
zip \
git \
jq \
openssl \
openssh \
sshpass \
krb5 \
krb5-dev \
#openjdk11-jre-headless \
; \
# Install build-dependent system packages
apk add --no-cache --virtual .build-deps \
gcc \
make \
musl-dev \
libffi-dev \
libxml2-dev \
libxslt-dev \
openssl-dev \
cargo \
rust \
gnupg \
tzdata \
; \
\
# Set timezone
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime; \
echo "${TIMEZONE}" > /etc/timezone; \
\
# Install Ansible, AWS and DNS python packages
if [[ "$(uname -m)" =~ ^.*arm.*$ ]] && [ "$(getconf LONG_BIT)" = "32" ]; then \
# Hotfix: QEMU/Buildx/Cargo issue for arm 32bit
# https://github.com/pyca/cryptography/issues/6673
git clone --bare https://github.com/rust-lang/crates.io-index.git \
~/.cargo/registry/index/github.com-1285ae84e5963aae; \
fi; \
python -m pip install --upgrade pip; \
pip install --no-cache-dir pip-tools; \
pip-compile -qo /usr/local/share/pip/install.pkgs /usr/local/share/pip/compile.pkgs; \
pip install --no-cache-dir -r /usr/local/share/pip/install.pkgs; \
\
# Install Azure cli
curl -Lo install-azure-cli.sh https://aka.ms/InstallAzureCli; \
chmod +x ./install-azure-cli.sh; \
sed -ie "s/^_TTY/#&/;s/< \$_TTY/#&/" ./install-azure-cli.sh; \
echo -e "/usr/local/lib/azure-cli\n/usr/local/bin\n\n" | ./install-azure-cli.sh; \
rm -rf install-azure-cli.sh install-azure-cli.she ~/.bashrc.backup; \
\
# Install HashiCorp binaries
mkdir -p /usr/local/share/hashicorp; \
wget --no-cache -qO /usr/local/share/hashicorp/install.sh https://raw.github.com/zeiss/install-hashicorp-binaries/master/install-hashicorp.sh; \
chmod +x /usr/local/share/hashicorp/install.sh; \
/usr/local/share/hashicorp/install.sh packer terraform; \
\
# Install ACME client
git clone --depth 1 https://github.com/dehydrated-io/dehydrated.git /usr/local/etc/dehydrated; \
ln -s /usr/local/etc/dehydrated/dehydrated /usr/local/bin/dehydrated; \
mkdir -p /usr/local/etc/dehydrated/hooks; \
wget --no-cache -qO /usr/local/etc/dehydrated/hooks/lexicon.sh https://raw.githubusercontent.com/AnalogJ/lexicon/master/examples/dehydrated.default.sh; \
\
# Remove build-dependent system packages and files
apk del .build-deps; \
pip cache purge; \
rm -rf ~/.cargo ~/.cache /tmp/*
COPY config /tmp/config
RUN set -eux; \
# Configure shell env
cat /tmp/config/.bashrc >> ~/.bashrc; \
# Install shell prompt
curl -Os https://starship.rs/install.sh; \
chmod +x ./install.sh; \
./install.sh -V -f; \
rm install.sh; \
mkdir -p ~/.config; \
mv /tmp/config/starship.toml ~/.config/starship.toml; \
# Install fonts
apk --update add --no-cache \
fontconfig \
font-noto-emoji \
; \
wget --no-cache -qO /tmp/SourceCodePro.zip https://github.com/ryanoasis/nerd-fonts/releases/latest/download/SourceCodePro.zip; \
mkdir -p /usr/share/fonts/nerd; \
unzip -d /usr/share/fonts/nerd /tmp/SourceCodePro.zip; \
find /usr/share/fonts/nerd/ -type f -name "*Windows Compatible.ttf" -exec rm -f {} \;; \
mv /tmp/config/nerd-emoji-font.conf /usr/share/fontconfig/conf.avail/05-nerd-emoji.conf; \
ln -s /usr/share/fontconfig/conf.avail/05-nerd-emoji.conf /etc/fonts/conf.d/05-nerd-emoji.conf; \
fc-cache -vf; \
# Install build-dependent system packages
apk add --no-cache --virtual .build-deps \
gcc \
make \
musl-dev \
ncurses-dev \
; \
# Install editor
git clone https://github.com/vim/vim.git /tmp/vim; \
cd /tmp/vim; \
./configure \
--with-features=huge \
--enable-multibyte \
--enable-python3interp=yes \
--with-python3-config-dir=$(python3-config --configdir) \
--enable-cscope \
--prefix=/usr/local \
; \
vim_version="$(git describe --tags $(git rev-list --tags --max-count=1) | sed -E 's/^v?([0-9]+)\.([0-9]+).*$/\1\2/')"; \
make VIMRUNTIMEDIR=/usr/local/share/vim/vim${vim_version}; \
make install; \
mv /tmp/config/.vimrc ~/.vimrc; \
# vim -c 'PlugInstall' -c 'qa!'; \
\
# Remove build-dependent system packages and files
apk del .build-deps; \
rm -rf /tmp/*
CMD [ "/bin/sh","-c","sleep infinity & wait" ]