1
0

Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. FROM docker.io/i386/alpine:3.20.0
  2. ENV KERNEL=lts
  3. ENV ADDPKGS=nodejs
  4. RUN apk add openrc alpine-base agetty alpine-conf $ADDPKGS
  5. RUN if [ "$KERNEL" == "lts" ]; then \
  6. apk add linux-lts \
  7. linux-firmware-none \
  8. linux-firmware-sb16; \
  9. else \
  10. apk add linux-$KERNEL; \
  11. fi
  12. RUN sed -i 's/getty 38400 tty1/agetty --autologin root tty1 linux/' /etc/inittab
  13. RUN echo 'ttyS0::respawn:/sbin/agetty --autologin root -s ttyS0 115200 vt100' >> /etc/inittab
  14. RUN echo "root:" | chpasswd
  15. RUN setup-hostname localhost
  16. # Adding networking.sh script (works only on lts kernel yet)
  17. RUN if [ "$KERNEL" == "lts" ]; then \
  18. echo -e "rmmod ne2k-pci && modprobe ne2k-pci\nhwclock -s\nsetup-interfaces -a -r" > /root/networking.sh && \
  19. chmod +x /root/networking.sh; \
  20. fi
  21. RUN echo 'console.log("Hello, world!");' > /root/hello.js
  22. # https://wiki.alpinelinux.org/wiki/Alpine_Linux_in_a_chroot#Preparing_init_services
  23. RUN for i in devfs dmesg mdev hwdrivers; do rc-update add $i sysinit; done
  24. RUN for i in hwclock modules sysctl hostname syslog bootmisc; do rc-update add $i boot; done
  25. RUN rc-update add killprocs shutdown
  26. # Generate initramfs with 9p modules
  27. RUN mkinitfs -F "ata base ide scsi virtio ext4 9p" $(cat /usr/share/kernel/$KERNEL/kernel.release)