如何使用 war 文件从 jfrog artifactory 到 github repo 中的 Dockerfile

How to use war file from jfrog artifactory to Dockerfile in github repo

我需要帮助来构建 ci 管道以仅构建 docker-image 并将其推送到 docker hub(所有都是私人回购。 我的要求是,在 git 回购协议中,我有如下 Dockerfile:

FROM tomcat:alpine
COPY snoop.war /opt/tomcat/tomcat1/webapps/
EXPOSE 8443
CMD /usr/local/tomcat/bin/cataline.bat run

在上面的 Dockerfile 中,我想直接从“jfrog”artifcactory 位置获取 war 文件,而不是“snoop.war”,因为我无法在 [= 中上传 war 文件24=] 回购由于安全策略cies。 预期的 Dockerfile 应该是:

FROM tomcat:alpine
COPY https://internal-jfrog-artifacts/war_file/mw_snapshots/snoop.war 
/opt/tomcat/tomcat1/webapps/
EXPOSE 8443
CMD /usr/local/tomcat/bin/cataline.bat run

请协助,是否可以通过进行一些更改来实现?

您需要先下载文件。尝试使用以下 Dockerfile.

构建
FROM tomcat:alpine
RUN apk add curl --no-cache \
    && mkdir -p /opt/tomcat/tomcat1/webapps \
    && curl -fsSL -o /opt/tomcat/tomcat1/webapps/snoop.war https://internal-jfrog-artifacts/war_file/mw_snapshots/snoop.war
EXPOSE 8443
CMD /usr/local/tomcat/bin/cataline.bat run