Docker and Podman images to compile DivestOS easily

This commit is contained in:
ElCorzo 2023-07-14 20:40:49 +02:00 committed by Tad
parent 15de8ed2e8
commit 34f89596f9
5 changed files with 49 additions and 0 deletions

29
Container/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM fedora:latest
ARG userid
ARG groupid
ARG username
#
RUN dnf -y update \
# && dnf -y install bash coreutils bzip2 curl java-1.8.0-openjdk java-1.8.0-openjdk-devel unzip zip zlib \
# && dnf -y install @development-tools tini android-tools automake bc bison bzip2-libs ccache
&& dnf -y install @development-tools android-tools automake bc bison bzip2 bzip2-libs ccache curl dpkg-dev flex gcc gcc-c++ git git-lfs glibc-devel.{x86_64,i686} gnupg gperf ImageMagick ImageMagick-c++-devel ImageMagick-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel libgcc.{x86_64,i686} libstdc++.{x86_64,i686} libX11-devel.{x86_64,i686} libxml2-devel libXrandr.{x86_64,i686} libXrender.{x86_64,i686} libxslt lz4-libs lzop make mesa-libGL-devel.{x86_64,i686} ncurses ncurses-compat-libs ncurses-devel.{x86_64,i686} ninja-build openssl-devel optipng jpegoptim perl-Digest-MD5-File perl-Switch pngcrush python python3-virtualenv python3 python3-mako python-mako python-markdown python-networkx readline-devel.{x86_64,i686} rsync schedtool SDL squashfs-tools syslinux-devel unzip wxGTK xml2 xz-lzma-compat zip zlib zlib-devel.{x86_64,i686} vim-common vboot-utils mozilla-fira-mono-fonts mozilla-fira-sans-fonts openssl1.1 nano htop \
&& dnf clean all \
&& curl -o /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo \
&& chmod a+x /usr/local/bin/repo \
&& sudo ln -sf /usr/share/crypto-policies/LEGACY/java.txt /etc/crypto-policies/back-ends/java.config
RUN groupadd -g $groupid $username \
&& useradd --create-home --shell /bin/bash --uid $userid --gid $groupid $username \
&& echo $username >/root/username \
&& echo "export USER="$username >>/home/$username/.gitconfig
COPY gitconfig /home/$username/.gitconfig
RUN mkdir -p /home/$username/android \
&& mkdir -p /home/$username/.ccache \
&& chown $userid:$groupid /home/$username/.gitconfig /home/$username/android /home/$username/.ccache
ENV HOME=/home/$username
ENV USER=$username
ENTRYPOINT chroot --userspec=$(cat /root/username):$(cat /root/username) --skip-chdir / /bin/bash -i

View File

@ -0,0 +1,7 @@
#!/bin/bash
# from https://android.googlesource.com/platform/build/+/master/tools/docker
# Copy your host gitconfig, or create a stripped down version
cp ~/.gitconfig gitconfig
docker build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t android-build-fedora .
rm gitconfig

View File

@ -0,0 +1,7 @@
#!/bin/bash
# from https://android.googlesource.com/platform/build/+/master/tools/docker
# Copy your host gitconfig, or create a stripped down version
cp ~/.gitconfig gitconfig
podman build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t android-build-fedora .
rm gitconfig

View File

@ -0,0 +1,3 @@
#!/bin/bash
mkdir -p $1 $2
docker run -it --rm -v $1:/home/$(id -un)/android -v $2:/home/$(id -un)/.ccache android-build-fedora

View File

@ -0,0 +1,3 @@
#!/bin/bash
mkdir -p $1 $2
podman run -it --rm --user=$(id -un) --workdir="/home/$(id -un)" --entrypoint="/bin/bash" -v $1:/home/$(id -un)/android -v $2:/home/$(id -un)/.ccache android-build-fedora