Skip to content

Commit

Permalink
Bugfix/resolve python package version conflict (#11)
Browse files Browse the repository at this point in the history
* Hotfix: QEMU/Buildx/Cargo issue for armv7

* Enhance cleanup
  • Loading branch information
rembik authored Dec 16, 2021
1 parent aa3da92 commit d6cbc0b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
with:
config-inline: |
[worker.oci]
max-parallelism = 1
max-parallelism = 4
-
name: Check out Docker Buildx cache
uses: actions/cache@v2
Expand Down
31 changes: 19 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ENV TIMEZONE=${TIMEZONE:-Europe/Berlin} \
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
Expand Down Expand Up @@ -43,32 +45,40 @@ RUN set -eux; \
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; \
pip cache purge; \
\
# 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 install-azure-cli.sh ~/.bashrc.backup; \
rm -rf install-azure-cli.sh install-azure-cli.she ~/.bashrc.backup; \
\
# Install HashiCorp binaries
mkdir -p /usr/local/share/hashicorp; \
wget -qO /usr/local/share/hashicorp/install.sh https://raw.github.com/zeiss/install-hashicorp-binaries/master/install-hashicorp.sh; \
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 -qO /usr/local/etc/dehydrated/hooks/lexicon.sh https://raw.githubusercontent.com/AnalogJ/lexicon/master/examples/dehydrated.default.sh; \
wget --no-cache -qO /usr/local/etc/dehydrated/hooks/lexicon.sh https://raw.githubusercontent.com/AnalogJ/lexicon/master/examples/dehydrated.default.sh; \
\
apk del .build-deps
# 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; \
Expand All @@ -86,10 +96,9 @@ RUN set -eux; \
fontconfig \
font-noto-emoji \
; \
wget -q https://github.com/ryanoasis/nerd-fonts/releases/latest/download/SourceCodePro.zip; \
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 SourceCodePro.zip; \
rm SourceCodePro.zip; \
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; \
Expand All @@ -115,13 +124,11 @@ RUN set -eux; \
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; \
rm -rf /tmp/vim; \
mv /tmp/config/.vimrc ~/.vimrc; \
# vim -c 'PlugInstall' -c 'qa!'; \
\
# Remove build-dependent system packages and files
apk del .build-deps; \
rm -rf /tmp/config

WORKDIR /srv
rm -rf /tmp/*

CMD [ "/bin/sh","-c","sleep infinity & wait" ]

0 comments on commit d6cbc0b

Please sign in to comment.