blob: de3b34dd7fa13f6ae0fcf2584ae69dc970845c04 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# Build stage: tests and every download. A failing test fails the image build, which is what lizCI checks.
FROM eclipse-temurin:21-jdk AS build
WORKDIR /src
# Android SDK: core and ui have Android targets, so Gradle needs one even for the desktop build.
ENV ANDROID_HOME=/opt/android-sdk
RUN apt-get update && apt-get install -y --no-install-recommends unzip zip curl && rm -rf /var/lib/apt/lists/* \
&& mkdir -p $ANDROID_HOME/cmdline-tools && curl -fsSL -o /tmp/clt.zip https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip \
&& unzip -q /tmp/clt.zip -d $ANDROID_HOME/cmdline-tools && mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest && rm /tmp/clt.zip \
&& yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null
# macOS Java runtimes can be linked on Linux from a macOS JDK's jmods, so keep just those (about 40 MB each).
RUN for a in aarch64 x64; do mkdir -p /opt/macjdk/$a \
&& curl -fsSL "https://api.adoptium.net/v3/binary/latest/21/ga/mac/$a/jdk/hotspot/normal/eclipse" \
| tar -xz -C /opt/macjdk/$a --strip-components=1 --wildcards '*/Contents/Home/jmods'; done
# Warm the Gradle wrapper and dependency cache before copying sources.
COPY gradlew settings.gradle.kts build.gradle.kts gradle.properties ./
COPY gradle gradle
COPY core/build.gradle.kts core/
COPY ui/build.gradle.kts ui/
COPY desktop/build.gradle.kts desktop/
COPY android/build.gradle.kts android/
RUN ./gradlew --no-daemon -q help
COPY . .
# Tests, then every download: the Linux app (with its runtime), the universal jar and the release APK.
RUN ./gradlew --no-daemon :core:jvmTest :desktop:createDistributable :desktop:universalJar :android:assembleRelease
RUN sh site/macos-app.sh 0.1.0
# The commit goes in last, so a new commit doesn't redo the build above's cache-able layers.
ARG COMMIT=unknown
RUN sh site/assemble.sh /site "$COMMIT"
# The deployed image: a static download page and the files it links to.
FROM nginx:alpine AS rookery
COPY site/nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -f /usr/share/nginx/html/index.html /usr/share/nginx/html/50x.html
COPY --from=build /site /usr/share/nginx/html
EXPOSE 80
|