Skip to content

Instantly share code, notes, and snippets.

@cwillsey06
Forked from m00nwtchr/Dockerfile
Last active December 24, 2022 13:53
Show Gist options
  • Select an option

  • Save cwillsey06/ff41d7c49f901036f19f4b965d1617b8 to your computer and use it in GitHub Desktop.

Select an option

Save cwillsey06/ff41d7c49f901036f19f4b965d1617b8 to your computer and use it in GitHub Desktop.
Compile ALVR client using Docker
# 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 --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
RUN useradd -m -G wheel -s /bin/bash aurbuild
RUN echo '%wheel ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel
USER aurbuild
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
sudo git clone https://aur.archlinux.org/yay-git.git /opt/yay-git
WORKDIR /opt/yay-git
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
sudo chown -R aurbuild:aurbuild .
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
makepkg -si --noconfirm
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
yay -S --noconfirm android-sdk
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 /
@cwillsey06
Copy link
Author

Quick 'install'

curl https://gist.githubusercontent.com/cwillsey06/ff41d7c49f901036f19f4b965d1617b8/raw/Dockerfile | DOCKER_BUILDKIT=1 docker build -o . -

Just in case the command above doesn't work for you, try this one

curl https://gist.githubusercontent.com/cwillsey06/ff41d7c49f901036f19f4b965d1617b8/raw/e1f6310ccf35df2c827fafceca810b7dc1d9732e/Dockerfile | DOCKER_BUILDKIT=1 docker build -o . -

And if you're really out of luck, just use this template and paste the link to the raw of this gist into the section marked as such
(and remove the markers, obviously)

curl <put-raw-link-here> | DOCKER_BUILDKIT=1 docker build -o . -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment