2022-06-02 02:21:56 +07:00
|
|
|
ARG ARG_COMPILE_BASE_IMAGE=accetto/ubuntu-vnc-xfce-opengl-g3
|
|
|
|
FROM $ARG_COMPILE_BASE_IMAGE as build
|
|
|
|
USER root
|
|
|
|
RUN apt update && \
|
|
|
|
apt upgrade -y && \
|
2024-01-28 19:48:33 +07:00
|
|
|
apt install --fix-broken -y wget curl openjdk-17-jdk openjdk-11-jdk unzip
|
2024-01-28 18:31:37 +07:00
|
|
|
|
2022-06-02 02:21:56 +07:00
|
|
|
WORKDIR /src
|
|
|
|
# Get dependencies
|
|
|
|
RUN wget -q -O packr-all-4.0.0.jar https://github.com/libgdx/packr/releases/download/4.0.0/packr-all-4.0.0.jar && \
|
2023-09-06 16:35:00 +07:00
|
|
|
wget -q -O jre-linux-64.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.19%2B7/OpenJDK11U-jre_x64_linux_hotspot_11.0.19_7.tar.gz
|
2022-06-02 02:21:56 +07:00
|
|
|
|
2024-01-28 19:48:33 +07:00
|
|
|
|
|
|
|
# Gradle is dumb (https://github.com/gradle/gradle/issues/22921) and doesn't recognize the JDK location
|
|
|
|
# Solution from https://www.linux.org.ru/forum/desktop/17285826 ¯\_(ツ)_/¯
|
|
|
|
RUN rm -rf /usr/lib/jvm/openjdk-17
|
|
|
|
RUN ln -s /usr/lib/jvm/java-17-openjdk-amd64 /usr/lib/jvm/openjdk-17
|
|
|
|
|
|
|
|
|
2022-06-02 02:21:56 +07:00
|
|
|
# https://nieldw.medium.com/caching-gradle-binaries-in-a-docker-build-when-using-the-gradle-wrapper-277c17e7dd22
|
2023-04-23 13:51:38 +07:00
|
|
|
# Get gradle distribution
|
2022-06-02 02:21:56 +07:00
|
|
|
COPY *.gradle gradle.* gradlew /src/
|
|
|
|
COPY gradle /src/gradle
|
|
|
|
WORKDIR /src
|
2023-06-04 03:30:44 +07:00
|
|
|
RUN chmod +x ./gradlew && ./gradlew --version
|
2022-06-02 02:21:56 +07:00
|
|
|
|
|
|
|
# Build unciv
|
|
|
|
COPY . /src/
|
2023-06-04 03:30:44 +07:00
|
|
|
RUN chmod +x ./gradlew && ./gradlew desktop:classes
|
|
|
|
RUN ./gradlew desktop:dist
|
2022-06-02 02:21:56 +07:00
|
|
|
RUN ./gradlew desktop:zipLinuxFilesForJar
|
2023-06-04 03:30:44 +07:00
|
|
|
RUN ./gradlew desktop:packrLinux64 --stacktrace --info --daemon --scan
|
|
|
|
RUN cd /src/deploy && unzip Unciv-Linux64.zip
|
2022-06-02 02:21:56 +07:00
|
|
|
|
|
|
|
FROM accetto/ubuntu-vnc-xfce-opengl-g3 as run
|
|
|
|
WORKDIR /home/headless/Desktop/
|
2023-04-23 13:51:38 +07:00
|
|
|
COPY --chown=1001:1001 --from=build /src/deploy/* /usr/
|
2023-05-24 14:30:01 +07:00
|
|
|
COPY --chown=1001:1001 --from=build /src/desktop/build/libs/Unciv.jar /usr/share/Unciv/Unciv.jar
|
2023-06-04 03:30:44 +07:00
|
|
|
COPY --chown=1001:1001 --chmod=0755 --from=build /src/desktop/linuxFilesForJar/* /home/headless/Desktop/
|
2023-04-23 13:51:38 +07:00
|
|
|
USER 1001
|
2023-06-04 03:30:44 +07:00
|
|
|
CMD [ "/home/headless/Desktop/Unciv.sh" ]
|