Skip to content

Commit fdf0dcb

Browse files
authored
Create debian-builder-unstable.dockerfile
1 parent 7cf0367 commit fdf0dcb

File tree

1 file changed

+187
-0
lines changed

1 file changed

+187
-0
lines changed
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# syntax=docker/dockerfile:1
2+
#------------------------------------------------------------------------------------#
3+
#https://hub.docker.com/r/azathothas/debian-builder-unstable
4+
FROM debian:unstable
5+
#------------------------------------------------------------------------------------#
6+
##Base Deps
7+
ENV DEBIAN_FRONTEND="noninteractive"
8+
RUN <<EOS
9+
#Base
10+
set +e
11+
export DEBIAN_FRONTEND="noninteractive"
12+
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
13+
packages="apt-transport-https apt-utils autopoint bash bison ca-certificates coreutils curl dos2unix fdupes file findutils gettext git gnupg2 gperf imagemagick jq locales locate moreutils nano ncdu p7zip-full rename rsync software-properties-common texinfo sudo tmux unzip util-linux xz-utils wget zip"
14+
#Install
15+
apt-get update -y -qq
16+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
17+
#Install_Re
18+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
19+
#NetTools
20+
packages="dnsutils inetutils-ftp inetutils-ftpd inetutils-inetd inetutils-ping inetutils-syslogd inetutils-tools inetutils-traceroute iproute2 net-tools netcat-traditional"
21+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
22+
packages="iputils-arping iputils-clockdiff iputils-ping iputils-tracepath iproute2"
23+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
24+
setcap 'cap_net_raw+ep' "$(which ping)"
25+
#Python
26+
apt-get install python3 -y
27+
#Test
28+
python --version 2>/dev/null ; python3 --version 2>/dev/null
29+
#Install pip:
30+
#python3 -m ensurepip --upgrade ; pip3 --version
31+
#curl -qfsSL "https://bootstrap.pypa.io/get-pip.py" -o "$SYSTMP/get-pip.py" && python3 "$SYSTMP/get-pip.py"
32+
packages="libxslt-dev lm-sensors pciutils procps python3-distro python-dev-is-python3 python3-lxml python3-netifaces python3-pip python3-venv sysfsutils virt-what"
33+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
34+
pip install --break-system-packages --upgrade pip || pip install --upgrade pip
35+
#Misc
36+
pip install ansi2txt --break-system-packages --force-reinstall --upgrade
37+
#pipx
38+
pip install pipx --upgrade 2>/dev/null
39+
pip install pipx --upgrade --break-system-packages 2>/dev/null
40+
EOS
41+
#------------------------------------------------------------------------------------#
42+
43+
#------------------------------------------------------------------------------------#
44+
##Create User + Setup Perms
45+
RUN <<EOS
46+
#Add runner
47+
useradd --create-home "runner"
48+
#Set password
49+
echo "runner:runneradmin" | chpasswd
50+
#Add runner to sudo
51+
usermod -aG "sudo" "runner"
52+
usermod -aG "sudo" "root"
53+
#Passwordless sudo for runner
54+
echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" >> "/etc/sudoers"
55+
#Remove preconfigured admin user
56+
userdel -r "admin" 2>/dev/null || true
57+
EOS
58+
##Change Default shell for runner to bash
59+
RUN <<EOS
60+
#Check current shell
61+
grep runner "/etc/passwd"
62+
#Change to bash
63+
usermod --shell "/bin/bash" "runner" 2>/dev/null
64+
curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/.bashrc" -o "/etc/bash.bashrc"
65+
dos2unix --quiet "/etc/bash.bashrc" 2>/dev/null
66+
ln --symbolic --force "/etc/bash.bashrc" "/home/runner/.bashrc" 2>/dev/null
67+
ln --symbolic --force "/etc/bash.bashrc" "/root/.bashrc" 2>/dev/null
68+
ln --symbolic --force "/etc/bash.bashrc" "/etc/bash/bashrc" 2>/dev/null
69+
#Recheck
70+
grep runner "/etc/passwd"
71+
EOS
72+
##Set PATH [Default: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin] /command is s6-tools
73+
#ENV PATH "/command:${PATH}"
74+
#RUN echo 'export PATH="/command:${PATH}"' >> "/etc/bash.bashrc"
75+
#------------------------------------------------------------------------------------#
76+
77+
#------------------------------------------------------------------------------------#
78+
##Addons
79+
RUN <<EOS
80+
##Addons
81+
#https://github.com/pkgforge/devscripts/blob/main/Linux/install_bins_curl.sh
82+
curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh" -o "./tools.sh"
83+
dos2unix --quiet "./tools.sh" && chmod +x "./tools.sh"
84+
bash "./tools.sh" 2>/dev/null || true ; rm -rf "./tools.sh"
85+
##Appimage tools
86+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/go-appimagetool.no_strip" -o "/usr/local/bin/go-appimagetool" && chmod +x "/usr/local/bin/go-appimagetool"
87+
curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "/usr/local/bin/appimagetool" && chmod +x "/usr/local/bin/appimagetool"
88+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/linuxdeploy.no_strip" -o "/usr/local/bin/linuxdeploy" && chmod +x "/usr/local/bin/linuxdeploy"
89+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/mkappimage" -o "/usr/local/bin/mkappimage" && chmod +x "/usr/local/bin/mkappimage"
90+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/Baseutils/squashfstools/mksquashfs" -o "/usr/local/bin/mksquashfs" && chmod +x "/usr/local/bin/mksquashfs"
91+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/Baseutils/squashfstools/sqfscat" -o "/usr/local/bin/sqfscat" && chmod +x "/usr/local/bin/sqfscat"
92+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/Baseutils/squashfstools/sqfstar" -o "/usr/local/bin/sqfstar" && chmod +x "/usr/local/bin/sqfstar"
93+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/Baseutils/squashfstools/unsquashfs" -o "/usr/local/bin/unsquashfs" && chmod +x "/usr/local/bin/unsquashfs"
94+
EOS
95+
#------------------------------------------------------------------------------------#
96+
97+
#------------------------------------------------------------------------------------#
98+
##Build Tools
99+
RUN <<EOS
100+
#----------------------#
101+
#Main
102+
set +e
103+
packages="aria2 autoconf autoconf-archive automake autopoint bc binutils b3sum brotli build-essential ca-certificates ccache clang cmake cmake-extras coreutils cython3 diffutils dos2unix execline findutils fontconfig gawk gcc gettext itstool lzip jq libtool libtool-bin make meson musl musl-dev musl-tools nasm policycoreutils pkg-config python3 p7zip-full spirv-cross rsync texinfo texi2html txt2html util-linux wget xsltproc xxhash xz-utils yasm"
104+
#Install
105+
apt-get update -y -qq
106+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
107+
#Install_Re
108+
for pkg in $packages; do DEBIAN_FRONTEND="noninteractive" apt install -y --ignore-missing "$pkg"; done
109+
#----------------------#
110+
#Dockerc
111+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/dockerc" -o "/usr/bin/dockerc" && chmod +x "/usr/bin/dockerc"
112+
#----------------------#
113+
#Install Meson & Ninja
114+
#sudo rm "/usr/bin/meson" "/usr/bin/ninja" 2>/dev/null
115+
pip install meson ninja --upgrade 2>/dev/null
116+
pip install meson ninja --break-system-packages --upgrade --force-reinstall 2>/dev/null
117+
#python3 -m pip install meson ninja --upgrade
118+
#Installs to /usr/local/bin/
119+
#sudo ln -s "$HOME/.local/bin/meson" "/usr/bin/meson" 2>/dev/null
120+
#sudo ln -s "$HOME/.local/bin/ninja" "/usr/bin/ninja" 2>/dev/null
121+
#sudo chmod +xwr "/usr/bin/meson" "/usr/bin/ninja" 2>/dev/null
122+
#----------------------#
123+
#libpcap
124+
sudo apt install libpcap-dev pcaputils -y 2>/dev/null
125+
#----------------------#
126+
#libsqlite3
127+
sudo apt-get install libsqlite3-dev sqlite3 sqlite3-pcre sqlite3-tools -y 2>/dev/null
128+
#----------------------#
129+
#lzma
130+
sudo apt-get install liblz-dev librust-lzma-sys-dev lzma lzma-dev -y
131+
#----------------------#
132+
#staticx: https://github.com/JonathonReinhart/staticx/blob/main/.github/workflows/build-test.yml
133+
export CWD="$(realpath .)" ; cd "$(mktemp -d)" >/dev/null 2>&1 ; realpath .
134+
#Switch to default: https://github.com/JonathonReinhart/staticx/pull/284
135+
git clone --filter "blob:none" "https://github.com/JonathonReinhart/staticx" --branch "add-type-checking" && cd "./staticx"
136+
#https://github.com/JonathonReinhart/staticx/blob/main/build.sh
137+
pip install -r "./requirements.txt" --break-system-packages --upgrade --force
138+
sudo apt-get update -y
139+
sudo apt-get install -y busybox musl-tools scons
140+
export BOOTLOADER_CC="musl-gcc"
141+
rm -rf "./build" "./dist" "./scons_build" "./staticx/assets"
142+
python "./setup.py" sdist bdist_wheel
143+
find "dist/" -name "*.whl" | xargs -I {} sh -c 'newname=$(echo {} | sed "s/none-[^/]*\.whl$/none-any.whl/"); mv "{}" "$newname"'
144+
find "dist/" -name "*.whl" | xargs pip install --break-system-packages --upgrade --force
145+
staticx --version || pip install staticx --break-system-packages --force-reinstall --upgrade ; unset BOOTLOADER_CC
146+
rm -rf "$(realpath .)" ; cd "${CWD}"
147+
#----------------------#
148+
#pyinstaller
149+
pip install "git+https://github.com/pyinstaller/pyinstaller" --break-system-packages --force-reinstall --upgrade ; pyinstaller --version
150+
#----------------------#
151+
#golang
152+
cd "$(mktemp -d)" >/dev/null 2>&1 ; realpath .
153+
curl -qfsSL "https://git.io/go-installer" -o "./install.sh"
154+
dos2unix --quiet "./install.sh" && chmod +x "./install.sh"
155+
echo "yes" | bash "./install.sh" 2>/dev/null || true
156+
rm -rf "$(realpath .)" ; cd "${CWD}"
157+
#patchelf
158+
curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/patchelf" -o "/usr/bin/patchelf" && chmod +x "/usr/bin/patchelf"
159+
#----------------------#
160+
#Rust
161+
cd "$(mktemp -d)" >/dev/null 2>&1 ; realpath .
162+
curl -qfsSL "https://sh.rustup.rs" -o "./install.sh"
163+
dos2unix --quiet "./install.sh" && chmod +x "./install.sh"
164+
bash "./install.sh" -y 2>/dev/null || true
165+
rm -rf "$(realpath .)" ; cd "${CWD}"
166+
#----------------------#
167+
EOS
168+
#------------------------------------------------------------------------------------#
169+
170+
#------------------------------------------------------------------------------------#
171+
#Start
172+
RUN <<EOS
173+
#Locale
174+
echo "LC_ALL=en_US.UTF-8" | tee -a "/etc/environment"
175+
echo "en_US.UTF-8 UTF-8" | tee -a "/etc/locale.gen"
176+
echo "LANG=en_US.UTF-8" | tee -a "/etc/locale.conf"
177+
locale-gen "en_US.UTF-8"
178+
#Dialog
179+
echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections
180+
debconf-show debconf
181+
EOS
182+
ENV DEBIAN_FRONTEND="noninteractive"
183+
ENV LANG="en_US.UTF-8"
184+
ENV LANGUAGE="en_US:en"
185+
ENV LC_ALL="en_US.UTF-8"
186+
ENV PATH="$HOME/bin:$HOME/.cargo/bin:$HOME/.cargo/env:$HOME/.go/bin:$HOME/go/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$HOME/.local/bin:$HOME/miniconda3/bin:$HOME/miniconda3/condabin:/usr/local/zig:/usr/local/zig/lib:/usr/local/zig/lib/include:/usr/local/musl/bin:/usr/local/musl/lib:/usr/local/musl/include:$PATH"
187+
#------------------------------------------------------------------------------------#

0 commit comments

Comments
 (0)