我正在尝试基于 Zulu OpenJDK 8 宽度 JavaFX 和 Maven 设置 Docker 映像。但不幸的是,JavaFX 不是 debian 二进制文件的一部分。
FROM azul/zulu-openjdk-debian:8u222
ARG MAVEN_VERSION=3.6.2
ARG SHA=d941423d115cd021514bfd06c453658b1b3e39e6240969caf4315ab7119a77299713f14b620fb2571a264f8dff2473d8af3cb47b05acf0036fc2553199a5c1ee
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
RUN apt-get update \
&& apt-get upgrade -y \
&& mkdir -p /usr/share/man/man1 \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& rm -f /usr/bin/mvn \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
不幸的是,我无法构建基于 JavaFX 的应用程序:
[ERROR] /builds/myproject/java-clients/examples/javafx/src/main/java/com/myproject/demo/fx/DemoFxClient.java:[28,20] package javafx.scene does not exist
我也尝试只使用 openjdk docker 镜像:
FROM openjdk:8-jdk-slim-buster
ARG MAVEN_VERSION=3.6.2
ARG SHA=d941423d115cd021514bfd06c453658b1b3e39e6240969caf4315ab7119a77299713f14b620fb2571a264f8dff2473d8af3cb47b05acf0036fc2553199a5c1ee
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
RUN apt-get update \
&& apt-get upgrade -y \
&& mkdir -p /usr/share/man/man1 \
&& apt-get install -y --no-install-recommends \
openjfx \
ca-certificates \
curl \
git \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& rm -f /usr/bin/mvn \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
是否有人能够创建支持 JavaFX 构建的 Docker 映像?