proot-apps/ci-scripts/Dockerfile.proot-builder
2024-04-08 15:48:47 -07:00

38 lines
1.1 KiB
Docker

# Xenial is used here for broad compatibility
FROM ubuntu:xenial
RUN \
echo "**** install build deps ****" && \
apt-get update && \
apt-get install -y \
curl \
gcc \
libarchive-dev \
libtalloc-dev && \
echo "**** ingest proot src ****" && \
mkdir /build && \
PROOT_RELEASE=$(curl -sX GET "https://api.github.com/repos/proot-me/proot/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]') && \
curl -L \
"https://github.com/proot-me/proot/archive/${PROOT_RELEASE}.tar.gz" \
| tar -xzf - -C "/build" --strip-components=1 && \
echo "**** build logic ****" && \
echo "#!/bin/bash" > /entrypoint && \
echo "make -C src loader.elf loader-m32.elf build.h" >> /entrypoint && \
echo "LDFLAGS=\"\${LDFLAGS} -static\" make -C src proot GIT=false" >> /entrypoint && \
echo "strip src/proot" >> /entrypoint && \
echo "mv src/proot /mnt/" >> /entrypoint && \
chmod +x /entrypoint && \
echo "**** cleanup ****" && \
apt-get autoremove && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/* \
/var/log/*
WORKDIR /build
ENTRYPOINT ["/entrypoint"]