mirror of
https://github.com/lukechilds/dockerpi.git
synced 2026-01-23 02:14:37 +00:00
Fix volume issues by mounting a dir
Extract a pre-existing image there if one doesn't already exist
This commit is contained in:
parent
e5ecf4cf75
commit
151aa1f623
2 changed files with 27 additions and 23 deletions
27
Dockerfile
27
Dockerfile
|
|
@ -9,30 +9,11 @@ RUN cd /tmp && \
|
|||
cp -r qemu-rpi-kernel-*/* /root/qemu-rpi-kernel/ && \
|
||||
rm -rf /tmp/* /root/qemu-rpi-kernel/README.md /root/qemu-rpi-kernel/tools
|
||||
|
||||
VOLUME /filesystem.img
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT ["qemu-system-arm"]
|
||||
CMD [ \
|
||||
"-M", "versatilepb", \
|
||||
"-cpu", "arm1176", \
|
||||
"-m", "256", \
|
||||
"-hda", "/filesystem.img", \
|
||||
"-net", "nic", \
|
||||
"-net", "user,hostfwd=tcp::5022-:22", \
|
||||
"-dtb", "/root/qemu-rpi-kernel/versatile-pb.dtb", \
|
||||
"-kernel", "/root/qemu-rpi-kernel/kernel-qemu-4.19.50-buster", \
|
||||
"-append", "root=/dev/sda2 panic=1", \
|
||||
"-no-reboot", \
|
||||
"-display", "none", \
|
||||
"-serial", "mon:stdio" \
|
||||
]
|
||||
ADD ./entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
|
||||
FROM dockerpi-vm as dockerpi
|
||||
LABEL maintainer="Luke Childs <lukechilds123@gmail.com>"
|
||||
|
||||
ADD http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip /tmp/filesystem.zip
|
||||
|
||||
RUN cd /tmp && \
|
||||
unzip *.zip && \
|
||||
mv *.img /filesystem.img && \
|
||||
rm -rf /tmp/*
|
||||
ADD http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip /filesystem.zip
|
||||
|
|
|
|||
23
entrypoint.sh
Executable file
23
entrypoint.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
image_path="/data/filesystem.img"
|
||||
zip_path="/filesystem.zip"
|
||||
|
||||
if [ ! -e $image_path ] && [ -e $zip_path ]; then
|
||||
unzip $zip_path
|
||||
mv *.img $image_path
|
||||
fi
|
||||
|
||||
exec qemu-system-arm \
|
||||
-M versatilepb \
|
||||
-cpu arm1176 \
|
||||
-m 256M \
|
||||
-hda /data/filesystem.img \
|
||||
-net nic \
|
||||
-net user,hostfwd=tcp::5022-:22 \
|
||||
-dtb /root/qemu-rpi-kernel/versatile-pb.dtb \
|
||||
-kernel /root/qemu-rpi-kernel/kernel-qemu-4.19.50-buster \
|
||||
-append "root=/dev/sda2 panic=1" \
|
||||
-no-reboot \
|
||||
-display none \
|
||||
-serial mon:stdio
|
||||
Loading…
Add table
Add a link
Reference in a new issue