ARG QtVersion=v6.8.3

FROM archlinux:latest
ARG QtVersion
LABEL org.opencontainers.image.title="Flowee Android Build Environment"
LABEL org.opencontainers.image.description="Official containerd package of all tools and libraries needed to build for Android aarch64 devices. Uses ArchLinux base with all the libraries needed for Flowee Pay."
LABEL org.opencontainers.image.authors="Tom <tom@flowee.org>"
LABEL org.opencontainers.image.url="http://bitcoincashcode.org/Flowee/pay/src/branch/master/android/docker/README.md"
LABEL org.opencontainers.image.documentation=""
LABEL org.opencontainers.image.source="http://bitcoincashcode.org/Flowee/pay/src/branch/master/android/docker/README.md"
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
LABEL org.opencontainers.image.version="${QtVersion}"
#unset variables set by the one we inherit
LABEL org.opencontainers.image.revision=""
LABEL org.opencontainers.image.created=""
ENTRYPOINT ["su", "-", "builduser", "-c"]

ADD scripts /usr/local/bin
# for europe you might want to copy your local mirrorlist
#copy mirrorlist /etc/pacman.d/
RUN useradd builduser -d /home/builds -m -u 1000 -U \
    && pacman -Suy --noconfirm --noprogressbar \
    && pacman -Sy --noconfirm --noprogressbar --needed base-devel \
    cmake \
    ninja \
    git \
    python \
    libjpeg-turbo \
    xcb-util-keysyms \
    xcb-util-cursor \
    libgl \
    fontconfig \
    xdg-utils \
    shared-mime-info \
    xcb-util-wm \
    libxrender \
    libxi \
    sqlite \
    mesa \
    vulkan-headers \
    tslib \
    libinput \
    libxkbcommon-x11 \
    libproxy \
    libcups \
    double-conversion \
    brotli \
    libb2 \
    md4c \
    wget \
    libc++ \
    libxcrypt-compat \
    jdk17-openjdk \
    && pacman -Sc --noconfirm \
    && rm -rf /var/cache/pacman/pkg/* \
    && /usr/local/bin/createRootPwd

# to enable caching, check the README.md
#add cache /usr/local/cache/
RUN mkdir -p /usr/local/cache \
    && git config --global advice.detachedHead false \
    && /usr/local/bin/aurs.sh \
    && rm -rf ~builduser/* \
    && /usr/local/bin/buildOpenSsl.sh \
    && rm -rf ~builduser/* \
    && /usr/local/bin/buildQt.sh ${QtVersion} \
    && rm -rf ~builduser/* \
    && /usr/local/bin/buildBoost.sh \
    && rm -rf ~builduser/* \
    && /usr/local/bin/buildZXing.sh \
    && rm -rf ~builduser/* \
    && rm -rf /usr/local/cache

