[英]docker build fails inside gitlab-runner but works locally : spring boot native compilation with GraalVm
[英]Quarkus graalvm native build dockerfile installation fails
我想通過 Dockerfile 部署一個 quarkus 構建器映像。 我們在代理后面,我將所有 linux 代理設置設置為大寫和小寫。
如果我運行 Dockerfile,我會在 gu 命令中收到一條錯誤消息來安裝本機映像組件。 這是 Dockerfile 中完整的運行語句:
# Install GraalVM
RUN curl -fsSL https://github.com/oracle/graal/releases/download/vm-${GRAALVM_VERSION}/graalvm-ce-linux-amd64-${GRAALVM_VERSION}.tar.gz > graalvm-ce-${GRAALVM_VERSION}.tar.gz && \
tar -xvf graalvm-ce-${GRAALVM_VERSION}.tar.gz && \
rm -f graalvm-ce-${GRAALVM_VERSION}.tar.gz && \
mv graalvm-ce-${GRAALVM_VERSION} /usr/lib/jvm/ && \
cd /usr/lib/jvm && \
ln -sfn graalvm-ce-${GRAALVM_VERSION} graalvm && \
alternatives --install /usr/bin/java java ${GRAALVM_HOME}bin/java 97
RUN printenv
RUN ${GRAALVM_HOME}bin/gu install native-image
它返回一條錯誤消息,其中包含我必須設置 http_proxy。 在運行語句之前,我啟動了一個 printenv 語句,因為我可以看到設置了 http_proxy env 變量。
在 dockerfile 的那部分之前和之后,我們下載並安裝其他東西。 那個有效。
唯一不起作用的是 gu 語句。
這是返回的日志消息:
Step 10/24 : RUN printenv
---> Running in e539ee727135
...
GRAALVM_HOME=/usr/lib/jvm/graalvm/
JAVA_HOME=/usr/lib/jvm/graalvm/
HTTP_PROXY=http://This-is-a:real@proxy.com:8080/
http_proxy=http://This-is-a:real@proxy.com:8080/
HTTPS_PROXY=http://This-is-a:real@proxy.com:8080/
https_proxy=http://This-is-a:real@proxy.com:8080/
GRAALVM_VERSION=19.2.1
...
Removing intermediate container e539ee727135
---> de3d463af567
Step 11/24 : RUN ${GRAALVM_HOME}bin/gu available
---> Running in d4a04b82279c
Downloading: Component catalog from www.graalvm.org
Error: Error downloading component catalog from https://www.graalvm.org/component-catalog/graal-updater-component-catalog.properties: Invalid argument or cannot assign requested address.
Please check your connection and proxy settings. If your machine is behind a proxy, environment variables (http_proxy, https_proxy, ...) must be set appropriately.
The command '/bin/sh -c ${GRAALVM_HOME}bin/gu install native-image' returned a non-zero code: 3
找到的不是真正的解決方案,而是一種解決方法。 我手動獲取組件並通過本地語句安裝它。 這是用於安裝本機構建的 Dockerfile 片段:
### Install GraalVM native build
RUN curl -fsL -o component.jar https://github.com/oracle/graal/releases/download/vm-${GRAALVM_VERSION}/native-image-installable-svm-linux-amd64-${GRAALVM_VERSION}.jar && \
${GRAALVM_HOME}bin/gu install -L component.jar && \
rm component.jar
那個有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.