简体   繁体   English

如何将 gradle 添加到我的高山基地 docker 图像中

[英]How to add gradle into my alpine base docker image

I create docker file using alpine base image and built the image.我使用 alpine 基础映像创建 docker 文件并构建了该映像。 That image contains java:11 and maven.该图像包含 java:11 和 maven。 I want to include gradle also.我也想包括 gradle。 How do i do it?我该怎么做?

This is the docker file get also from Stackoverflow.这是同样来自 Stackoverflow 的 docker 文件。

from alpine:3.10

run apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
run apk add bash vim curl wget jq docker git tar unzip bash-completion ca-certificates
run cd /opt && curl -sSl http://mirror.vorboss.net/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz



env PATH "$PATH:/opt/apache-maven-3.6.3/bin"
entrypoint ["/bin/bash"]

I just stole from here :我刚刚从这里偷了:

FROM alpine:3.10

ENV GRADLE_VERSION 3.2

RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
RUN apk add bash vim curl wget jq docker git tar unzip bash-completion ca-certificates
RUN cd /opt && curl -sSl http://mirror.vorboss.net/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz

RUN apk -U add --no-cache curl; \
    curl https://downloads.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip > gradle.zip; \
    unzip gradle.zip; \
    rm gradle.zip; \
    apk del curl; \
    apk update && apk add --no-cache libstdc++ && rm -rf /var/cache/apk/*

ENV PATH "$PATH:/opt/apache-maven-3.6.3/bin:/gradle-${GRADLE_VERSION}/bin/"
ENTRYPOINT ["/bin/bash"]

Simpler version just using the current latest Alpine, which also has packages for Maven 3.6.3 and a much more recent Gradle than above.更简单的版本仅使用当前最新的 Alpine,它还包含 Maven 3.6.3 和比上面更新的 Gradle 的软件包。 You can toy around with the versions, of course.当然,您可以玩弄这些版本。

FROM alpine:3.12.3

RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
RUN apk add bash vim curl wget jq docker git tar unzip bash-completion ca-certificates gradle maven

ENTRYPOINT ["/bin/bash"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM