GithubHelp home page GithubHelp logo

Comments (6)

carlossg avatar carlossg commented on May 19, 2024 2

Thanks @tianon
Cool, I just merged #47 so only generate-stackbrew-library is needed. I'll merge if you submit a PR

from docker-maven.

longquan7 avatar longquan7 commented on May 19, 2024

I am not sure this file can be support arm64 https://apache.osuosl.org/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz

from docker-maven.

carlossg avatar carlossg commented on May 19, 2024

I don't know what your question is. If you want to check maven in arm you should ask in the maven user list

from docker-maven.

tianon avatar tianon commented on May 19, 2024

@carlossg I believe he's referring to https://github.com/docker-library/official-images#architectures-other-than-amd64 and https://github.com/docker-library/official-images#multiple-architectures (which as of yesterday are now using manifest lists, so docker run debian, etc can run on all supported arches!)

I think your Dockerfiles here would probably work as-is on many architectures supported by the openjdk and ibmjava base images you're descended from. If that ends up being the case, we simply need to update library/maven to the newer RFC-2822-based file format so we can add appropriate Architectures entries (which we usually scrape directly via bashbrew in our generate-stackbrew-library.sh scripts for @docker-library repos).

I'm happy to take a crack at it if officially supporting multiple architectures is something you're willing to do! 👍

from docker-maven.

tianon avatar tianon commented on May 19, 2024

So far, the changes required are just adjusting the path in 9-jdk{,-slim} to use dpkg --print-architecture instead of hard-coded amd64, and then things seem to "just work" on both arm64v8 and s390x:

$ docker run -it --rm maven:3.5.0-jdk-7 mvn -v
OpenJDK 64-Bit Zero VM warning: You have loaded library /usr/share/maven/lib/jansi-native/linux64/libjansi.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-s390x/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-3-s390x", arch: "s390x", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-7-slim mvn -v
OpenJDK 64-Bit Zero VM warning: You have loaded library /usr/share/maven/lib/jansi-native/linux64/libjansi.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-s390x/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-3-s390x", arch: "s390x", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-8 mvn -v
OpenJDK 64-Bit Zero VM warning: You have loaded library /usr/share/maven/lib/jansi-native/linux64/libjansi.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.8.0_141, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-s390x/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-3-s390x", arch: "s390x", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-8-slim mvn -v
OpenJDK 64-Bit Zero VM warning: You have loaded library /usr/share/maven/lib/jansi-native/linux64/libjansi.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.8.0_141, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-s390x/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-3-s390x", arch: "s390x", family: "unix"
$ docker run -it --rm maven:3.5.0-ibmjava-8 mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.8.0, vendor: IBM Corporation
Java home: /opt/ibm/java/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.9.0-3-s390x", arch: "s390x", family: "unix"
$ docker run -it --rm maven:3.5.0-ibmjava-9 mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 9-internal, vendor: IBM Corporation
Java home: /opt/ibm/java
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.9.0-3-s390x", arch: "s390x", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-7 mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-arm64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-92-generic", arch: "aarch64", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-7-slim mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-arm64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-92-generic", arch: "aarch64", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-8 mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.8.0_141, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-arm64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-92-generic", arch: "aarch64", family: "unix"
$ docker run -it --rm maven:3.5.0-jdk-8-slim mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
Maven home: /usr/share/maven
Java version: 1.8.0_141, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-arm64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-92-generic", arch: "aarch64", family: "unix"
diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh
index 571d50b..4b6b4b5 100755
--- a/generate-stackbrew-library.sh
+++ b/generate-stackbrew-library.sh
@@ -7,7 +7,14 @@ variants=( alpine slim )
 
 cd "$(dirname "${BASH_SOURCE[0]}")"
 
-url='git://github.com/carlossg/docker-maven'
+url='https://github.com/carlossg/docker-maven.git'
+
+# prints "$2$1$3$1...$N"
+join() {
+	local sep="$1"; shift
+	local out; printf -v out "${sep//%/%%}%s" "$@"
+	echo "${out#$sep}"
+}
 
 generate-version() {
 	local version=$1
@@ -49,6 +56,7 @@ generate-version() {
 	# tag 3, latest
 	if [[ "$version" == "$default_jdk-$latest" ]]; then
 		versionAliases+=( $mavenVersion latest )
+		[ "$branch" = 'master' ] || versionAliases+=( "$branch" )
 	elif [[ "$version" == *"-$latest" ]]; then
 		# tag 3-ibmjava ibmjava
 		versionAliases+=( $mavenVersion-${version//-$latest/} ${version//-$latest/} )
@@ -64,18 +72,20 @@ generate-version() {
 			fi
 		fi
 	done
-	
+
+	from="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
+	arches="$(bashbrew cat --format '{{- join ", " .TagEntry.Architectures -}}' "$from")"
+
 	echo
-	for va in "${versionAliases[@]}"; do
-		if [ "$branch" != 'master' ] && [ "$va" = 'latest' ]; then
-			echo "${branch}: ${url}@${commit} $version"
-		else
-			echo "${va}${branch_suffix}: ${url}@${commit} $version"
-		fi
-	done
+	echo "Tags: $(join ', ' "${versionAliases[@]}")"
+	echo "Architectures: $arches"
+	[ "$branch" = 'master' ] || echo "GitFetch: refs/heads/$branch"
+	echo "GitCommit: $commit"
+	echo "Directory: $version"
 }
 
-echo '# maintainer: Carlos Sanchez <[email protected]> (@carlossg)'
+echo 'Maintainers: Carlos Sanchez <[email protected]> (@carlossg)'
+echo "GitRepo: $url"
 
 versions=( jdk-*/ ibmjava-*/ )
 versions=( "${versions[@]%/}" )
diff --git a/jdk-9-slim/Dockerfile b/jdk-9-slim/Dockerfile
index 0359bd4..08bfc0e 100644
--- a/jdk-9-slim/Dockerfile
+++ b/jdk-9-slim/Dockerfile
@@ -13,7 +13,7 @@ RUN apt-get update && \
 # Maven fails with 'Can't read cryptographic policy directory: unlimited'
 # because it looks for $JAVA_HOME/conf/security/policy/unlimited but it is in
 # /etc/java-9-openjdk/security/policy/unlimited
-RUN ln -s /etc/java-9-openjdk /usr/lib/jvm/java-9-openjdk-amd64/conf
+RUN ln -s /etc/java-9-openjdk "/usr/lib/jvm/java-9-openjdk-$(dpkg --print-architecture)/conf"
 
 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 \
diff --git a/jdk-9/Dockerfile b/jdk-9/Dockerfile
index 3eaa491..2b2eb61 100644
--- a/jdk-9/Dockerfile
+++ b/jdk-9/Dockerfile
@@ -8,7 +8,7 @@ ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
 # Maven fails with 'Can't read cryptographic policy directory: unlimited'
 # because it looks for $JAVA_HOME/conf/security/policy/unlimited but it is in
 # /etc/java-9-openjdk/security/policy/unlimited
-RUN ln -s /etc/java-9-openjdk /usr/lib/jvm/java-9-openjdk-amd64/conf
+RUN ln -s /etc/java-9-openjdk "/usr/lib/jvm/java-9-openjdk-$(dpkg --print-architecture)/conf"
 
 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 \

Would be happy to turn this into a PR if it seems reasonable to you! It's currently using bashbrew cat to grab the Architectures list of the parent images directly, but you could also simply embed the current values directly if you'd rather not have a dependency on bashbrew. 👍

from docker-maven.

longquan7 avatar longquan7 commented on May 19, 2024

That's great, thanks

from docker-maven.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.