diff --git a/Container/Dockerfile b/Container/Dockerfile new file mode 100644 index 00000000..bd0d0d81 --- /dev/null +++ b/Container/Dockerfile @@ -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 + diff --git a/Container/build-image-docker.sh b/Container/build-image-docker.sh new file mode 100644 index 00000000..47a5ae83 --- /dev/null +++ b/Container/build-image-docker.sh @@ -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 diff --git a/Container/build-image-podman.sh b/Container/build-image-podman.sh new file mode 100644 index 00000000..31bc4496 --- /dev/null +++ b/Container/build-image-podman.sh @@ -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 diff --git a/Container/run-image-docker.sh b/Container/run-image-docker.sh new file mode 100644 index 00000000..fd4572b0 --- /dev/null +++ b/Container/run-image-docker.sh @@ -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 diff --git a/Container/run-image-podman.sh b/Container/run-image-podman.sh new file mode 100644 index 00000000..715687d6 --- /dev/null +++ b/Container/run-image-podman.sh @@ -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