Last active
November 6, 2022 20:14
-
-
Save bademux/1f56981c2a0b149de15ed7250d7c4149 to your computer and use it in GitHub Desktop.
java wine docker apline
This file contains 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
#use DOCKER_BUILDKIT=1 to cache downloaded layer and --output to export built Artefact | |
#DOCKER_BUILDKIT=1 docker build --progress=plain --output type=tar,dest=../artefact.tar . | |
FROM scratch as caching-downloader | |
ADD https://api.adoptium.net/v3/binary/latest/19/ga/windows/x64/jdk/hotspot/normal/eclipse /jdk.zip | |
FROM alpine:3.16 as builder | |
RUN apk add --no-cache --update wine git util-linux | |
RUN adduser -D user | |
ENV WINEPREFIX=/home/user \ | |
WINEDEBUG=-all \ | |
JAVA_OPTS="-Xmx2G -Dfile.encoding=UTF-8" | |
USER user | |
COPY --chown=user --from=caching-downloader / /tmp | |
WORKDIR "$WINEPREFIX/drive_c/Program Files" | |
RUN unzip /tmp/jdk.zip -d /tmp && rm /tmp/jdk.zip && mv /tmp/jdk* jdk | |
RUN wine64 wineboot --init && \ | |
wine64 reg add "HKEY_CURRENT_USER\\Environment" /v JAVA_HOME /t REG_SZ /d "c:\\Program Files\\jdk" && \ | |
wine64 reg add "HKEY_CURRENT_USER\\Environment" /v PATH /t REG_SZ /d "C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;C:\\dev\\gradle\\bin;;Z:\\bin\\git;C:\\dev\\Program Files\\jdk\\bin" && \ | |
wineserver -w && \ | |
sleep 5 | |
WORKDIR "$WINEPREFIX/drive_c/project" | |
COPY --chown=user . . | |
ENV GRADLE_OPTS="-Dorg.gradle.caching=false -Dorg.gradle.caching.debug=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=false -Dorg.gradle.console=plain -Dorg.gradle.vfs.watch=false -Dorg.gradle.welcome=never" | |
#script is used to hackfix Stdout\err gradle error https://github.com/gradle/native-platform/issues/323 | |
RUN script --return --quiet -c "wine64 cmd /c gradlew.bat clean jlink" /dev/null | |
FROM scratch AS export-stage | |
COPY --from=builder /home/user/drive_c/project/app/build/jre / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment