Skip to content

Commit

Permalink
Switch to eclipse-temurin:17-jre-focal by default (#862)
Browse files Browse the repository at this point in the history
This is to fix Docker builds on Apple Silicon.

Fixes #794
  • Loading branch information
melix authored Nov 7, 2023
1 parent 3e5c8d7 commit d47ff1c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

public abstract class MicronautDockerfile extends Dockerfile implements DockerBuildOptions {
public static final String DEFAULT_WORKING_DIR = "/home/app";
public static final String DEFAULT_BASE_IMAGE = "eclipse-temurin:17-jre-focal";

@Input
private final Property<String> baseImage;
Expand Down Expand Up @@ -109,7 +110,7 @@ protected void setupInstructions(List<Instruction> additionalInstructions) {
case LAMBDA:
javaApplication.getMainClass().set("io.micronaut.function.aws.runtime.MicronautLambdaRuntime");
default:
from(new Dockerfile.From(from != null ? from : "openjdk:17-alpine"));
from(new Dockerfile.From(from != null ? from : DEFAULT_BASE_IMAGE));
setupResources(this);
exposePort(exposedPorts);
getInstructions().addAll(additionalInstructions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Application {
"""

testProjectDir.newFile("Dockerfile") << """
FROM openjdk:17-alpine
FROM eclipse-temurin:17-jre-focal
WORKDIR /home/alternate
COPY layers/libs /home/alternate/libs
COPY layers/classes /home/alternate/classes
Expand Down Expand Up @@ -189,7 +189,7 @@ class Application {

and:
def dockerfile = new File(testProjectDir.root, 'build/docker/main/Dockerfile').text
dockerfile == """FROM openjdk:17-alpine
dockerfile == """FROM eclipse-temurin:17-jre-focal
WORKDIR /home/alternate
COPY layers/libs /home/alternate/libs
COPY layers/classes /home/alternate/classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MicronautAOTDockerSpec extends AbstractAOTPluginSpec {
result.task(":optimizedDockerfile").outcome != TaskOutcome.FAILED

def dockerFile = normalizeLineEndings(file("build/docker/optimized/Dockerfile").text)
dockerFile == """FROM openjdk:17-alpine
dockerFile == """FROM eclipse-temurin:17-jre-focal
WORKDIR /home/app
COPY layers/libs /home/app/libs
COPY layers/classes /home/app/classes
Expand All @@ -47,7 +47,7 @@ ENTRYPOINT ["java", "-jar", "/home/app/application.jar"]
result.task(":optimizedDockerBuild").outcome != TaskOutcome.FAILED

def dockerFile = normalizeLineEndings(file("build/docker/optimized/Dockerfile").text)
dockerFile == """FROM openjdk:17-alpine
dockerFile == """FROM eclipse-temurin:17-jre-focal
WORKDIR /home/app
COPY layers/libs /home/app/libs
COPY layers/classes /home/app/classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class Application {

then:
def dockerfile = new File(testProjectDir.root, 'build/docker/main/Dockerfile').text
dockerfile == """FROM openjdk:17-alpine
dockerfile == """FROM eclipse-temurin:17-jre-focal
WORKDIR /home/app
COPY layers/libs /home/app/libs
COPY server.iprof /home/app/server.iprof
Expand Down Expand Up @@ -769,7 +769,7 @@ class Application {

then:
def dockerfile = new File(testProjectDir.root, 'build/docker/main/Dockerfile').text
dockerfile == """FROM openjdk:17-alpine
dockerfile == """FROM eclipse-temurin:17-jre-focal
WORKDIR /home/app
COPY layers/libs /home/app/libs
COPY server.iprof /home/app/server.iprof
Expand Down
2 changes: 1 addition & 1 deletion src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:native-gradle-plugin: https://graalvm.github.io/native-build-tools/{native-build-tools-version}/gradle-plugin.html
:gradle-docs: https://docs.gradle.org/{gradle-version}/userguide
:gradle-toolchains: {gradle-docs}/toolchains.html
:default-docker-image: openjdk:17-alpine
:default-docker-image: eclipse-temurin:17-jre-focal
:docker-plugin: https://github.com/bmuschko/gradle-docker-plugin
:aws-docs: https://micronaut-projects.github.io/micronaut-aws/latest/guide/index.html#customRuntimes
:testresources-guide: https://micronaut-projects.github.io/micronaut-test-resources/latest/guide
Expand Down

0 comments on commit d47ff1c

Please sign in to comment.