Created
April 15, 2025 08:04
-
-
Save phuslu/5a6b400a754e76a380ec77eb8f3893b1 to your computer and use it in GitHub Desktop.
alpine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A seashell buried in the sand, meant only to hear the sea at night. | |
# see https://hub.docker.com/r/phuslu/alpine/ | |
FROM alpine:3.21 | |
RUN \ | |
apk update && \ | |
apk upgrade && \ | |
apk add --update --no-cache \ | |
bash \ | |
bind-tools \ | |
curl \ | |
dropbear \ | |
fastfetch \ | |
gcompat \ | |
htop \ | |
iproute2 \ | |
jq \ | |
lsblk \ | |
openrc \ | |
openssh-client \ | |
openssh-sftp-server \ | |
openssl \ | |
procps \ | |
rsync \ | |
tmux \ | |
tzdata \ | |
vim \ | |
xz && \ | |
# add openrc configs for docker | |
echo $'\n\ | |
rc_env_allow="*"\n\ | |
rc_logger="YES"\n\ | |
rc_provide="loopback net"\n\ | |
rc_sys="docker"\n'\ | |
>> /etc/rc.conf && \ | |
# modify other configs | |
sed -i '/^for _cmd; do$/,/^done$/d' /usr/libexec/rc/sh/openrc-run.sh && \ | |
sed -i 's/mount -t tmpfs/true/g' /usr/libexec/rc/sh/init.sh && \ | |
sed -i 's/hostname $opts/# hostname $opts/g' /etc/init.d/hostname && \ | |
sed -i 's/^DROPBEAR_OPTS=.*/DROPBEAR_OPTS="-p 127.0.0.1:22"/' /etc/conf.d/dropbear && \ | |
sed -i '/tty/d' /etc/inittab && \ | |
rm -f /etc/init.d/hwclock \ | |
/etc/init.d/hwdrivers \ | |
/etc/init.d/modules \ | |
/etc/init.d/modules-load \ | |
/etc/init.d/modloop && \ | |
# add cloudinit | |
echo $'#!/sbin/openrc-run\n\ | |
description="start cloudinit"\n\ | |
depend() {\n\ | |
after dropbear\n\ | |
}\n\ | |
start()\n\ | |
{\n\ | |
if test -n "$cloudinit" ; then\n\ | |
bash <(curl -sSlf $cloudinit)\n\ | |
fi\n\ | |
return 0\n\ | |
}\n'\ | |
> /etc/init.d/cloudinit && \ | |
chmod +x /etc/init.d/cloudinit && \ | |
# add auto-start services | |
rc-update add dropbear default && \ | |
rc-update add cloudinit default && \ | |
# set bash for root | |
sed -i 's#root:x:0:0:root:/root:/bin/sh#root:x:0:0:root:/root:/bin/bash#g' /etc/passwd && \ | |
curl -sSlf phus.lu/bashrc >/root/.bash_profile | |
CMD ["init"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment