Last active
December 24, 2022 13:52
-
-
Save m00nwtchr/fae4424ff6cda5772bf624a08005e43e to your computer and use it in GitHub Desktop.
Compile ALVR client using Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syntax=docker/dockerfile:1.3 | |
| FROM archlinux AS build | |
| ARG VERSION="latest" | |
| RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \ | |
| pacman -Syu --noconfirm | |
| RUN pacman-key --init && pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com && pacman-key --lsign-key FBA220DFC880C036 | |
| RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \ | |
| pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' | |
| RUN echo -e "[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf | |
| RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \ | |
| pacman -Sy --needed --noconfirm base-devel cmake git unzip rustup cargo jre11-openjdk-headless jdk8-openjdk clang python android-sdk | |
| RUN useradd -m -G wheel -s /bin/bash aurbuild | |
| RUN echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel | |
| USER aurbuild | |
| WORKDIR /tmp | |
| RUN rustup default stable && rustup target add aarch64-linux-android | |
| RUN git clone https://github.com/alvr-org/ALVR.git | |
| RUN --mount=type=cache,sharing=locked,target=/tmp/ALVR/target \ | |
| sudo chown aurbuild -R /tmp/ALVR | |
| WORKDIR /tmp/ALVR | |
| RUN if [ "$VERSION" != "latest" ]; then git checkout "${VERSION}"; fi | |
| RUN --mount=type=cache,sharing=locked,target=/tmp/ALVR/target \ | |
| cargo xtask prepare-deps --platform android | |
| ENV ANDROID_HOME=/opt/android-sdk | |
| RUN sudo archlinux-java set java-8-openjdk | |
| RUN yes | sudo ${ANDROID_HOME}/tools/bin/sdkmanager "patcher;v4" "cmake;3.18.1" "ndk;25.1.8937393" "platforms;android-33" "build-tools;33.0.0" | |
| RUN sudo archlinux-java set java-11-openjdk | |
| RUN --mount=type=cache,sharing=locked,target=/tmp/ALVR/target \ | |
| cargo xtask build-client --platform oculus_quest --release | |
| FROM scratch AS export | |
| COPY --from=build /tmp/ALVR/build/alvr_client_oculus_quest/alvr_client_oculus_quest.apk / |
Author
I updated the file to make docker install yay instead of using the chaotic-aur, as every time I've tried to add chaotic via command line, it fails with some kind-of fetch error. I've searched online and I haven't found anyone else who is affected by this issue, but hey, rather be safe than sorry, right?
https://gist.github.com/cwillsey06/ff41d7c49f901036f19f4b965d1617b8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super convenient:tm: one-liner:
sudo version:
Might need to add
--no-cacheto make it rebuild if you want a new version after already using this method.