Skip to content

Commit 0f48cd5

Browse files
feat: compiles over Jdk17 with multiarch based images (#5542)
* feat: multiplatform base image for common:scala * feat: jdk17-scala 2.12.10-gradle 7.6.2 build * fix: wsk CLI requires a glibc based image, using eclipse-temurin:21-jre * fix: trailspaces in common Dockerfiles * fix: ensure elasticsearch hostname is resolved
1 parent 7ef091c commit 0f48cd5

File tree

33 files changed

+207
-135
lines changed

33 files changed

+207
-135
lines changed

.scalafmt.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18+
version = 1.5.1
1819
style = intellij
1920
danglingParentheses = false
2021
maxColumn = 120

ansible/elasticsearch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# This playbook deploys a ElasticSearch cluster
1919

2020
- hosts: elasticsearch
21+
gather_facts: yes
2122
vars:
2223
#
2324
# host_group - usually "{{ groups['...'] }}" where '...' is what was used

ansible/roles/elasticsearch/templates/elasticsearch.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cluster.name: "{{ db.elasticsearch.cluster_name }}"
22
node.name: "{{ elasticsearch_name }}"
33
network.host: 0.0.0.0
4-
network.publish_host: {{ ansible_default_ipv4.address }}
4+
network.publish_host: {{ ansible_default_ipv4.address | default(ansible_host | default('127.0.0.1')) }}
55

66
http.port: 9200
77
transport.tcp.port: {{ transport_port }}

build.gradle

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
buildscript {
1919
repositories {
20-
jcenter()
20+
gradlePluginPortal()
21+
mavenCentral()
2122
}
2223
dependencies {
2324
classpath "gradle.plugin.cz.alenkacz:gradle-scalafmt:${gradle.scalafmt.version}"
@@ -26,6 +27,7 @@ buildscript {
2627

2728
plugins {
2829
id "org.scoverage" version "7.0.0" apply false
30+
id "cz.alenkacz.gradle.scalafmt" version "1.16.2" apply false
2931
}
3032

3133
subprojects {
@@ -41,16 +43,21 @@ subprojects {
4143
// ./gradlew :test:dependencies | grep -o 'akka-.*_' | cut -c 6- | rev | cut -c 2- | rev | sort -u
4244
def cons = project.getDependencies().getConstraints()
4345
def akka = ['akka-actor', 'akka-cluster', 'akka-cluster-metrics', 'akka-cluster-tools', 'akka-coordination',
44-
'akka-discovery', 'akka-distributed-data', 'akka-protobuf', 'akka-remote', 'akka-slf4j',
45-
'akka-stream', 'akka-stream-testkit', 'akka-testkit', 'akka-persistence', 'akka-cluster-sharding']
46+
'akka-discovery', 'discovery-kubernetes-api', 'discovery-marathon-api', 'akka-distributed-data','grpc-runtime','akka-protobuf', 'akka-remote', 'akka-slf4j',
47+
'akka-stream', 'akka-stream-testkit', 'akka-testkit', 'akka-persistence', 'akka-cluster-sharding','akka-protobuf-v3','akka-pki','akka-parsing','akka-management-cluster-bootstrap','akka-management',
48+
'akka-kryo-serialization']
4649
def akkaHttp = ['akka-http', 'akka-http-core', 'akka-http-spray-json', 'akka-http-testkit', 'akka-http-xml',
4750
'akka-parsing', 'akka-http2-support']
51+
def akkaKafka = ['akka-stream-kafka-testkit','akka-stream-kafka','akka-stream-alpakka-s3','akka-stream-alpakka-file']
4852

4953
akka.forEach {
50-
cons.add('compile', "com.typesafe.akka:${it}_${gradle.scala.depVersion}:${gradle.akka.version}")
54+
cons.add('implementation', "com.typesafe.akka:${it}_${gradle.scala.depVersion}:${gradle.akka.version}")
5155
}
5256
akkaHttp.forEach {
53-
cons.add('compile', "com.typesafe.akka:${it}_${gradle.scala.depVersion}:${gradle.akka_http.version}")
57+
cons.add('implementation', "com.typesafe.akka:${it}_${gradle.scala.depVersion}:${gradle.akka_http.version}")
58+
}
59+
akkaKafka.forEach{
60+
cons.add('implementation', "com.typesafe.akka:${it}_${gradle.scala.depVersion}:${gradle.akka_kafka.version}")
5461
}
5562
}
5663

@@ -72,9 +79,17 @@ subprojects {
7279
}
7380
}
7481
}
82+
83+
configurations {
84+
implementationResolvable {
85+
canBeResolved = true
86+
canBeConsumed = false
87+
extendsFrom configurations.implementation
88+
}
89+
}
7590
}
7691

77-
if (project.plugins.hasPlugin('maven')) {
92+
if (project.plugins.hasPlugin('maven-publish')) {
7893
task sourcesJar(type: Jar, dependsOn: classes) {
7994
classifier = 'sources'
8095
from sourceSets.main.allSource
@@ -90,18 +105,12 @@ subprojects {
90105
classifier = 'tests'
91106
from sourceSets.test.output
92107
}
93-
94-
artifacts {
95-
archives sourcesJar
96-
archives testSourcesJar
97-
archives testClassesJar
98-
}
99108
}
100109

101110
if (project.plugins.hasPlugin('application')) {
102111
//Ensure that dist archive name does not contain version
103112
distTar {
104-
archiveName = "${project.name}.tar"
113+
archiveFileName = "${project.name}.tar"
105114
}
106115

107116
//Avoid generating the zip files from maven installations

common/scala/Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17-
# if you change version of openjsk, also update tools/github/setup.sh to download the corresponding jdk
18-
FROM adoptopenjdk/openjdk11-openj9:x86_64-alpine-jdk-11.0.12_7_openj9-0.27.0
17+
# if you change version of openjdk, also update tools/github/setup.sh to download the corresponding jdk
18+
# NOTE:
19+
# OpenWhisk will use a 21-jre multi arch image, compilation will be done with a jdk 17 temurin based image.
20+
# as wsk CLI is compiled against glibc we need touse a GLIBC based JRE Image (alpine it is not GLIBC based)
21+
FROM eclipse-temurin:21-jre
1922

20-
ENV LANG en_US.UTF-8
21-
ENV LANGUAGE en_US:en
22-
ENV LC_ALL en_US.UTF-8
23+
ENV LANG=en_US.UTF-8
24+
ENV LANGUAGE=en_US:en
25+
ENV LC_ALL=en_US.UTF-8
2326

24-
# Switch to the HTTPS endpoint for the apk repositories as per https://github.com/gliderlabs/docker-alpine/issues/184
25-
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
26-
RUN apk add --update sed curl bash && apk update && apk upgrade
27+
# Install curl, bash, sed
28+
RUN apt-get update && \
29+
apt-get install -y curl bash sed openssl && \
30+
apt-get clean && \
31+
rm -rf /var/lib/apt/lists/*
2732

2833
RUN mkdir /logs
2934

common/scala/Dockerfile.arm

Lines changed: 0 additions & 34 deletions
This file was deleted.

common/scala/build.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@
1717

1818
plugins {
1919
id 'eclipse'
20-
id 'maven'
20+
id 'maven-publish'
2121
id 'org.scoverage'
2222
id 'scala'
2323
id 'java-library'
2424
}
2525

2626
ext.dockerImageName = 'scala'
27-
if(System.getProperty("os.arch").toLowerCase(Locale.ENGLISH).startsWith("aarch")) {
28-
ext.dockerDockerfileSuffix = ".arm"
29-
}
27+
28+
// Using a multiarch base image should make this supefluous
29+
//if(System.getProperty("os.arch").toLowerCase(Locale.ENGLISH).startsWith("aarch")) {
30+
// ext.dockerDockerfileSuffix = ".arm"
31+
//}
32+
3033
apply from: '../../gradle/docker.gradle'
3134

3235
project.archivesBaseName = "openwhisk-common"
@@ -56,7 +59,7 @@ dependencies {
5659
api "com.typesafe.akka:akka-http-core_${gradle.scala.depVersion}:${gradle.akka_http.version}"
5760
api "com.typesafe.akka:akka-http-spray-json_${gradle.scala.depVersion}:${gradle.akka_http.version}"
5861

59-
api "com.lightbend.akka:akka-stream-alpakka-file_${gradle.scala.depVersion}:1.1.2"
62+
api "com.lightbend.akka:akka-stream-alpakka-file_${gradle.scala.depVersion}:2.0.2"
6063

6164
api "ch.qos.logback:logback-classic:1.2.11"
6265
api "org.slf4j:jcl-over-slf4j:1.7.25"
@@ -141,10 +144,12 @@ dependencies {
141144
api "io.netty:netty-codec-http2:${gradle.netty.version}"
142145
api "io.netty:netty-transport-native-epoll:${gradle.netty.version}"
143146
api "io.netty:netty-transport-native-unix-common:${gradle.netty.version}"
147+
api "com.lightbend.akka.grpc:akka-grpc-runtime_${gradle.scala.depVersion}:${gradle.akka_gprc.version}"
148+
api "com.typesafe.akka:akka-stream_${gradle.scala.depVersion}:${gradle.akka.version}"
144149
}
145150

146151
configurations {
147-
compile {
152+
api {
148153
exclude group: 'commons-logging'
149154
exclude group: 'log4j'
150155
}

core/controller/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM scala
18+
ARG BASE=scala
19+
FROM ${BASE}
1920

2021
ENV UID=1001 \
2122
NOT_ROOT_USER=owuser
@@ -30,8 +31,6 @@ ENV SWAGGER_UI_DOWNLOAD_SHA256=3d7ef5ddc59e10f132fe99771498f0f1ba7a2cbfb9585f986
3031
# If this cannot be guaranteed, set `invoker_use_runc: false` in the ansible env.
3132
ENV DOCKER_VERSION=23.0.6
3233

33-
RUN apk add --update openssl
34-
3534
# Uncomment to fetch latest version of docker instead: RUN wget -qO- https://get.docker.com | sh
3635
# Install docker client
3736
RUN curl -sSL -o docker-${DOCKER_VERSION}.tgz https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz && \
@@ -56,7 +55,7 @@ ADD build/distributions/controller.tar /
5655
COPY init.sh /
5756
RUN chmod +x init.sh
5857

59-
RUN adduser -D -u ${UID} -h /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
58+
RUN useradd -m -u 1001 -d /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
6059

6160
# It is possible to run as non root if you dont need invoker capabilities out of the controller today
6261
# When running it as a non-root user this has implications on the standard directory where runc stores its data.

core/controller/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
plugins {
1919
id 'application'
2020
id 'eclipse'
21-
id 'maven'
21+
id 'maven-publish'
2222
id 'org.scoverage'
2323
id 'scala'
2424
}

core/cosmosdb/cache-invalidator/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM scala
18+
ARG BASE=scala
19+
FROM ${BASE}
1920

2021
ENV UID=1001 \
2122
NOT_ROOT_USER=owuser
@@ -27,7 +28,7 @@ ADD build/distributions/cache-invalidator.tar /
2728
COPY init.sh /
2829
RUN chmod +x init.sh
2930

30-
RUN adduser -D -u ${UID} -h /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
31+
RUN useradd -m -u 1001 -d /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
3132
USER ${NOT_ROOT_USER}
3233

3334
EXPOSE 8080

core/cosmosdb/cache-invalidator/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
plugins {
1919
id 'application'
2020
id 'eclipse'
21-
id 'maven'
21+
id 'maven-publish'
2222
id 'org.scoverage'
2323
id 'scala'
2424
}

core/invoker/Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM scala
18+
ARG BASE=scala
19+
FROM ${BASE}
1920

2021
ENV UID=1001 \
2122
NOT_ROOT_USER=owuser \
@@ -24,9 +25,6 @@ ENV UID=1001 \
2425
# Docker server version and the invoker docker version must be the same to enable runc usage.
2526
# If this cannot be guaranteed, set `invoker_use_runc: false` in the ansible env.
2627

27-
28-
RUN apk add --update openssl
29-
3028
# Uncomment to fetch latest version of docker instead: RUN wget -qO- https://get.docker.com | sh
3129
# Install docker client
3230
RUN curl -sSL -o docker-${DOCKER_VERSION}.tgz https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz && \
@@ -43,7 +41,7 @@ RUN chmod +x init.sh
4341

4442
# When running the invoker as a non-root user this has implications on the standard directory where runc stores its data.
4543
# The non-root user should have access on the directory and corresponding permission to make changes on it.
46-
RUN adduser -D -u ${UID} -h /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
44+
RUN useradd -m -u 1001 -d /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
4745

4846
EXPOSE 8080
4947
CMD ["./init.sh", "0"]

core/invoker/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
plugins {
1919
id 'application'
2020
id 'eclipse'
21-
id 'maven'
21+
id 'maven-publish'
2222
id 'org.scoverage'
2323
id 'scala'
2424
}

core/monitoring/user-events/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM scala
18+
ARG BASE=scala
19+
FROM ${BASE}
1920

2021
ENV UID=1001 \
2122
NOT_ROOT_USER=owuser
@@ -26,7 +27,7 @@ ADD build/distributions/user-events.tar /
2627
COPY init.sh /
2728
RUN chmod +x init.sh
2829

29-
RUN adduser -D -u ${UID} -h /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
30+
RUN useradd -m -u 1001 -d /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
3031
USER ${NOT_ROOT_USER}
3132

3233
# Prometheus port

core/monitoring/user-events/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
plugins {
1919
id 'application'
2020
id 'eclipse'
21-
id 'maven'
21+
id 'maven-publish'
2222
id 'org.scoverage'
2323
id 'scala'
2424
}

core/scheduler/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18-
FROM scala
18+
ARG BASE=scala
19+
FROM ${BASE}
1920

2021
ENV UID=1001 \
2122
NOT_ROOT_USER=owuser
@@ -26,7 +27,7 @@ ADD build/distributions/scheduler.tar /
2627
COPY init.sh /
2728
RUN chmod +x init.sh
2829

29-
RUN adduser -D -u ${UID} -h /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
30+
RUN useradd -m -u 1001 -d /home/${NOT_ROOT_USER} -s /bin/bash ${NOT_ROOT_USER}
3031
USER ${NOT_ROOT_USER}
3132

3233
EXPOSE 8080

0 commit comments

Comments
 (0)