1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-30 00:13:43 +02:00
flashrom/util/manibuilder/Dockerfile.anita
Nico Huber 79efb45da9 manibuilder: Switch Dockerfile.anita to Bullseye and Python 3
Basing the image on debian:stable turned out to be a bad idea once
stable switched to Bullseye. Instead of falling back to Buster, we
move forward to Bullseye and pin that version. Hopefully that works
for some years again.

With Bullseye it turned out to be easier to do things with Python 3,
so we use that now. To ease future changes, we use tinier RUN and ARG
steps which creates more intermediate images. Such intermediate images
can be reused if some later step is changed in the Dockerfile.

Change-Id: Ic064ddad807329a9bd81085775190615ad89273f
Signed-off-by: Nico Huber <nico.h@gmx.de>
Ticket: https://ticket.coreboot.org/issues/383
Reviewed-on: https://review.coreboot.org/c/flashrom/+/65633
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-09-27 13:51:53 +00:00

67 lines
2.2 KiB
Docker

FROM debian:bullseye
ARG PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.1/All
ARG INST_IMG=http://ftp.de.netbsd.org/pub/NetBSD/NetBSD-7.1/amd64/
RUN \
useradd -p locked -m mani && \
apt-get -qq update && \
apt-get -qq upgrade && \
apt-get -qq dist-upgrade && \
apt-get -qqy install git python-is-python3 python3-pexpect \
python3-distutils genisoimage qemu-system && \
apt-get clean
RUN git clone https://github.com/gson1703/anita.git
RUN cd anita && python setup.py install
ARG DISK_SIZE=1G
ARG INSTALL_MEM=128M
USER mani
RUN cd && mkdir .ccache && chown mani:mani .ccache && \
anita --sets kern-GENERIC,modules,base,etc,comp \
--disk-size ${DISK_SIZE} --memory-size=${INSTALL_MEM} \
install ${INST_IMG} && \
rm -rf work-*/download
ARG EXTRA_PKG=""
ARG RUNTIME_MEM=128M
RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \
"echo 'dhcpcd' >init && \
echo 'export PKG_PATH=${PKG_PATH}' >>init && \
. ./init && \
pkg_add gmake git-base ccache pciutils libusb1 libusb-compat libftdi \
${EXTRA_PKG} && \
git config --global --add http.sslVerify false && \
git clone https://review.coreboot.org/flashrom.git" \
boot ${INST_IMG}
RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \
anita --vmm-args '-hdb cache.img' --persist \
--memory-size=${RUNTIME_MEM} --run \
"if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \
bdev=wd1d; \
else \
bdev=wd1c; \
fi; \
newfs -I \${bdev} && \
mkdir .ccache && \
mount /dev/\${bdev} .ccache && \
ccache -M 60M && \
umount .ccache && \
echo 'manitest() {' >>init && \
echo ' fsck -y -t ffs /dev/'\${bdev} >>init && \
echo ' mount /dev/'\${bdev}' ~/.ccache' >>init && \
echo ' (cd ~/flashrom && eval \" \$*\")' >>init && \
echo ' ret=\$?' >>init && \
echo ' umount ~/.ccache' >>init && \
echo ' return \$ret' >>init && \
echo '}' >>init" \
boot ${INST_IMG} && \
gzip cache.img
COPY anita-wrapper.sh /home/mani/mani-wrapper.sh
ENV INST_IMG ${INST_IMG}
ENV MEM_SIZE ${RUNTIME_MEM}
ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"]