From d5b5ae369c5810dfd8dc0279d85b412c3d98e9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Mon, 4 Mar 2019 12:38:53 +0000 Subject: [PATCH] Better layer caching for fedora image --- fedora/Dockerfile | 16 ++++++++-------- fedora/up.sh | 38 +++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/fedora/Dockerfile b/fedora/Dockerfile index 2696d62a..ae24321c 100644 --- a/fedora/Dockerfile +++ b/fedora/Dockerfile @@ -3,19 +3,19 @@ FROM fedora:29 ENV LC_ALL en_GB.UTF-8 ENV LANG en_GB.UTF-8 -RUN dnf -y upgrade --best --allowerasing - -RUN dnf -y --best --allowerasing install tmux atop zsh firefox aria2 gajim lm_sensors freecad python3-pip qt5-qtbase-devel qt5-qtwebkit-devel whois curl pv terminator gsmartcontrol python-pip mercurial python3-devel libxslt-devel libjpeg-turbo-devel cmake gtk2-devel intltool gparted glances dkms kernel-devel gimp git xz util-linux-user dnf-automatic kdiff3 yum-utils util-linux-user ncurses-devel zeal qt5-linguist qtkeychain-qt5-devel archivemount keepass splix gutenprint-cups cups-bjnp golang redhat-rpm-config pcsc-lite-devel pcsc-tools pcsc-lite yubico-piv-tool yubikey-personalization-gui xloadimage yp-tools closure-compiler optipng jpegoptim grub2 grub2-efi dracut dracut-tools openssl-devel fail2ban syncthing ansible gnome-tweaks xclip wget - -RUN dnf -y install docker - RUN dnf -y groupinstall "C Development Tools and Libraries" RUN dnf -y groupinstall "Development Tools" RUN dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm -RUN dnf -y groupupdate core -RUN dnf -y install ffmpeg-libs +RUN dnf -y copr enable jdoss/wireguard + +RUN dnf -y groupupdate core +RUN dnf -y upgrade --best --allowerasing + +RUN dnf -y groupinstall gnome + +RUN dnf -y --best --allowerasing install tmux atop zsh firefox aria2 gajim lm_sensors freecad python3-pip qt5-qtbase-devel qt5-qtwebkit-devel whois curl pv terminator gsmartcontrol python-pip mercurial python3-devel libxslt-devel libjpeg-turbo-devel cmake gtk2-devel intltool gparted glances dkms kernel-devel gimp git xz util-linux-user dnf-automatic kdiff3 yum-utils util-linux-user ncurses-devel zeal qt5-linguist qtkeychain-qt5-devel archivemount keepass splix gutenprint-cups cups-bjnp golang redhat-rpm-config pcsc-lite-devel pcsc-tools pcsc-lite yubico-piv-tool yubikey-personalization-gui xloadimage yp-tools closure-compiler optipng jpegoptim grub2 grub2-efi dracut dracut-tools openssl-devel fail2ban syncthing ansible gnome-tweaks xclip wget wireguard-dkms wireguard-tools lldb python-lldb kdbg zlib-devel libuuid-devel libattr-devel libblkid-devel libselinux-devel libudev-devel parted lsscsi ksh openssl-devel elfutils-libelf-devel libtirpc-devel kernel-devel ffmpeg-libs dnf-plugins-core RUN mkdir -p /root/dev/ # vim diff --git a/fedora/up.sh b/fedora/up.sh index b518939b..a963e22b 100755 --- a/fedora/up.sh +++ b/fedora/up.sh @@ -2,29 +2,33 @@ set -e -if [[ -z $NOUPGRADE ]]; then - sudo dnf -y upgrade --best --allowerasing -fi - -sudo dnf -y --best --allowerasing install tmux atop zsh firefox aria2 gajim lm_sensors freecad python3-pip qt5-qtbase-devel qt5-qtwebkit-devel whois curl pv terminator gsmartcontrol python-pip mercurial python3-devel libxslt-devel libjpeg-turbo-devel cmake gtk2-devel intltool gparted glances dkms kernel-devel gimp git xz util-linux-user dnf-automatic kdiff3 yum-utils util-linux-user ncurses-devel zeal qt5-linguist qtkeychain-qt5-devel archivemount keepass splix gutenprint-cups cups-bjnp golang redhat-rpm-config pcsc-lite-devel pcsc-tools pcsc-lite yubico-piv-tool yubikey-personalization-gui xloadimage yp-tools closure-compiler optipng jpegoptim grub2 grub2-efi dracut dracut-tools openssl-devel fail2ban syncthing ansible gnome-tweaks xclip wget - -sudo dnf -y install docker - sudo dnf -y groupinstall "C Development Tools and Libraries" sudo dnf -y groupinstall "Development Tools" sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm -sudo dnf -y groupupdate core -sudo dnf -y install ffmpeg-libs +sudo dnf -y copr enable jdoss/wireguard -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if [[ -z $NOUPGRADE ]]; then + sudo dnf -y groupupdate core + sudo dnf -y upgrade --best --allowerasing +fi + +sudo dnf -y --best --allowerasing install tmux atop zsh firefox aria2 gajim lm_sensors freecad python3-pip qt5-qtbase-devel qt5-qtwebkit-devel whois curl pv terminator gsmartcontrol python-pip mercurial python3-devel libxslt-devel libjpeg-turbo-devel cmake gtk2-devel intltool gparted glances dkms kernel-devel gimp git xz util-linux-user dnf-automatic kdiff3 yum-utils util-linux-user ncurses-devel zeal qt5-linguist qtkeychain-qt5-devel archivemount keepass splix gutenprint-cups cups-bjnp golang redhat-rpm-config pcsc-lite-devel pcsc-tools pcsc-lite yubico-piv-tool yubikey-personalization-gui xloadimage yp-tools closure-compiler optipng jpegoptim grub2 grub2-efi dracut dracut-tools openssl-devel fail2ban syncthing ansible gnome-tweaks xclip wget wireguard-dkms wireguard-tools lldb python-lldb kdbg zlib-devel libuuid-devel libattr-devel libblkid-devel libselinux-devel libudev-devel parted lsscsi ksh openssl-devel elfutils-libelf-devel libtirpc-devel kernel-devel ffmpeg-libs dnf-plugins-core + +HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +sudo dnf remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine + +sudo dnf config-manager -y --add-repo https://download.docker.com/linux/fedora/docker-ce.repo + +sudo dnf install -y docker-ce docker-ce-cli containerd.io sudo cp -v /etc/dnf/automatic.conf /etc/dnf/automatic.conf.bak -sudo cp -v $DIR/etc/dnf/automatic.conf /etc/dnf/automatic.conf -sudo cp -v $DIR/etc/sysctl.d/90_swapiness.conf /etc/sysctl.d/ -sudo cp -v $DIR/etc/sysctl.d/91_inotify_limit.conf /etc/sysctl.d/ -sudo cp -v $DIR/etc/fail2ban/jail.d/01-sshd.conf /etc/fail2ban/jail.d/ +sudo cp -v $HERE/etc/dnf/automatic.conf /etc/dnf/automatic.conf +sudo cp -v $HERE/etc/sysctl.d/90_swapiness.conf /etc/sysctl.d/ +sudo cp -v $HERE/etc/sysctl.d/91_inotify_limit.conf /etc/sysctl.d/ +sudo cp -v $HERE/etc/fail2ban/jail.d/01-sshd.conf /etc/fail2ban/jail.d/ sudo ldconfig set +e @@ -85,6 +89,6 @@ if [ "$(id -u)" != "0" ]; then code --install-extension vscodevim.vim fi -DIR="$DIR/../" -DIR="$DIR" $DIR/common/configure_fresh_system.sh +HERE="$HERE/../" +HERE="$HERE" $HERE/common/configure_fresh_system.sh