Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/maven/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ func insertMavenDepsStage(lines []string) (string, error) {
mavenDepsLines := []string{
"FROM " + MavenImage + " AS maven-deps",
"COPY pom.xml /tmp/pom.xml",
"RUN cd /tmp && mvn -f pom.xml dependency:go-offline",
"RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies " +
"-Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true " +
"-DoutputDirectory=/maven-repository " +
"&& cd /root/.m2/repository " +
"&& find . -name '*.pom' -exec cp --parents -t /maven-repository {} +",
}

// Find the insertion point: strip trailing blank lines before
Expand Down Expand Up @@ -78,7 +82,7 @@ func insertMavenDepsStage(lines []string) (string, error) {
}
}

copyLine := "COPY --from=maven-deps /root/.m2/repository /maven-repository"
copyLine := "COPY --from=maven-deps /maven-repository /maven-repository"
if copyInsertAt < 0 {
newLines = append(newLines, copyLine)
return strings.Join(newLines, "\n"), nil
Expand Down
7 changes: 4 additions & 3 deletions internal/maven/pom.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ var (
)

// RenderPOM generates a Maven POM XML from a parsed plugin config.
// The POM includes all runtime dependencies, additional runtimes, and
// kotlin-maven-plugin for Kotlin plugins. maven-compiler-plugin and
// maven-source-plugin are bundled in the maven-jdk base image.
// The POM includes all runtime dependencies, additional runtimes,
// and kotlin-maven-plugin as a dependency for Kotlin plugins.
// Compiler configuration (apiVersion, jvmTarget, etc.) is read from
// the database by the compile service, not from this POM.
func RenderPOM(pluginConfig *bufremotepluginconfig.Config) (string, error) {
if pluginConfig.Registry == nil || pluginConfig.Registry.Maven == nil {
return "", fmt.Errorf("no Maven registry configured for %q", pluginConfig.Name)
Expand Down
31 changes: 7 additions & 24 deletions internal/maven/pom.xml.gotext
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,12 @@
</dependency>
{{- end }}
{{- end }}
{{- if $kotlinCompiler.Version }}
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>{{ $kotlinCompiler.Version | xml }}</version>
</dependency>
{{- end }}
</dependencies>
{{- if $kotlinCompiler.Version }}
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
{{- with $kotlinCompiler.Version }}
<version>{{ . | xml }}</version>
{{- end }}
<configuration>
{{- with $kotlinCompiler.APIVersion }}
<apiVersion>{{ . | xml }}</apiVersion>
{{- end }}
{{- with $kotlinCompiler.JVMTarget }}
<jvmTarget>{{ . | xml }}</jvmTarget>
{{- end }}
{{- with $kotlinCompiler.LanguageVersion }}
<languageVersion>{{ . | xml }}</languageVersion>
{{- end }}
</configuration>
</plugin>
</plugins>
</build>
{{- end }}
</project>
29 changes: 13 additions & 16 deletions internal/maven/pom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type pomProject struct {
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Packaging string `xml:"packaging"`
Dependencies []pomDependency `xml:"dependencies>dependency"`
Build *pomBuild `xml:"build"`
}
Expand Down Expand Up @@ -80,7 +81,7 @@ registry:
},
},
{
name: "Kotlin compiler plugin configuration",
name: "Kotlin compiler adds plugin dependency",
yaml: `version: v1
name: buf.build/test/kotlin-plugin
plugin_version: v1.0.0
Expand All @@ -97,16 +98,12 @@ registry:
deps: []
`,
check: func(t *testing.T, p pomProject, _ string) { //nolint:thelper
require.NotNil(t, p.Build)
require.Len(t, p.Build.Plugins, 1)
plugin := p.Build.Plugins[0]
assert.Equal(t, "org.jetbrains.kotlin", plugin.GroupID)
assert.Equal(t, "kotlin-maven-plugin", plugin.ArtifactID)
assert.Equal(t, "1.8.22", plugin.Version)
require.NotNil(t, plugin.Configuration)
assert.Equal(t, "1.8", plugin.Configuration.JVMTarget)
assert.Equal(t, "1.8", plugin.Configuration.LanguageVersion)
assert.Equal(t, "1.8", plugin.Configuration.APIVersion)
require.Len(t, p.Dependencies, 1)
dep := p.Dependencies[0]
assert.Equal(t, "org.jetbrains.kotlin", dep.GroupID)
assert.Equal(t, "kotlin-maven-plugin", dep.ArtifactID)
assert.Equal(t, "1.8.22", dep.Version)
assert.Nil(t, p.Build)
},
},
{
Expand Down Expand Up @@ -193,11 +190,11 @@ registry:
deps: []
`,
check: func(t *testing.T, p pomProject, _ string) { //nolint:thelper
assert.Empty(t, p.Dependencies)
require.NotNil(t, p.Build)
require.Len(t, p.Build.Plugins, 1)
assert.Equal(t, "kotlin-maven-plugin", p.Build.Plugins[0].ArtifactID)
assert.Equal(t, "1.9.0", p.Build.Plugins[0].Version)
require.Len(t, p.Dependencies, 1)
assert.Equal(t, "org.jetbrains.kotlin", p.Dependencies[0].GroupID)
assert.Equal(t, "kotlin-maven-plugin", p.Dependencies[0].ArtifactID)
assert.Equal(t, "1.9.0", p.Dependencies[0].Version)
assert.Nil(t, p.Build)
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/maven/regenerate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ENTRYPOINT ["/app"]
dockerfileBytes, err := os.ReadFile(filepath.Join(consumerDir, "Dockerfile"))
require.NoError(t, err)
assert.Contains(t, string(dockerfileBytes), "FROM "+MavenImage+" AS maven-deps")
assert.Contains(t, string(dockerfileBytes), "COPY --from=maven-deps /root/.m2/repository /maven-repository")
assert.Contains(t, string(dockerfileBytes), "COPY --from=maven-deps /maven-repository /maven-repository")

// Read and parse pom.xml to verify deps include versions.
pomBytes, err := os.ReadFile(filepath.Join(consumerDir, "pom.xml"))
Expand Down
4 changes: 2 additions & 2 deletions plugins/apple/servicetalk/v0.42.63/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ FROM gcr.io/distroless/java21-debian12:latest@sha256:f34fd3e4e2d7a246d764d0614f5

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM scratch
COPY --from=base --link / /
COPY --from=build --link --chmod=0755 --chown=root:root /app/servicetalk-grpc-protoc.jar .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/usr/bin/java", "-jar", "/servicetalk-grpc-protoc.jar"]
4 changes: 2 additions & 2 deletions plugins/bufbuild/connect-kotlin/v0.1.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ RUN curl -fsSL -o /app/protoc-gen-connect-kotlin.jar https://repo1.maven.org/mav

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/java17-debian11
WORKDIR /app
COPY --from=build /app/protoc-gen-connect-kotlin.jar /app
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
CMD ["/app/protoc-gen-connect-kotlin.jar"]
16 changes: 5 additions & 11 deletions plugins/bufbuild/connect-kotlin/v0.1.10/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,10 @@
<artifactId>protobuf-javalite</artifactId>
<version>3.24.3</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.8.22</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.8.22</version>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
4 changes: 2 additions & 2 deletions plugins/bufbuild/validate-java/v1.3.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ RUN CGO_ENABLED=0 go install -ldflags "-s -w" -trimpath github.com/envoyproxy/pr

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM scratch
COPY --from=build --link /etc/passwd /etc/passwd
COPY --from=build --link --chown=root:root /go/bin/protoc-gen-validate-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-validate-java" ]
4 changes: 2 additions & 2 deletions plugins/community/salesforce-reactive-grpc/v1.2.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ FROM gcr.io/distroless/java21-debian12:latest@sha256:7c9a9a362eadadb308d29b9c7fe

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM scratch
COPY --from=base --link / /
COPY --from=build --link --chmod=0755 --chown=root:root /app/reactor-grpc-protoc.jar .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/usr/bin/java", "-jar", "/reactor-grpc-protoc.jar"]
4 changes: 2 additions & 2 deletions plugins/connectrpc/kotlin/v0.7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ FROM gcr.io/distroless/java21-debian12:latest@sha256:7c05bf8a64ff1a70a16083e9bdd

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM scratch
COPY --from=base --link / /
COPY --from=build --link --chmod=0755 --chown=root:root /app/protoc-gen-connect-kotlin.jar .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/usr/bin/java", "-jar", "/protoc-gen-connect-kotlin.jar"]
17 changes: 5 additions & 12 deletions plugins/connectrpc/kotlin/v0.7.4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,10 @@
<artifactId>protobuf-javalite</artifactId>
<version>4.31.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<apiVersion>1.8</apiVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.54.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.54.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.55.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.56.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.56.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.57.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.57.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.57.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.58.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.59.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
4 changes: 2 additions & 2 deletions plugins/grpc/java/v1.59.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN arch=${TARGETARCH}; \

FROM maven:3.9.11-eclipse-temurin-21 AS maven-deps
COPY pom.xml /tmp/pom.xml
RUN cd /tmp && mvn -f pom.xml dependency:go-offline
RUN cd /tmp && mvn -f pom.xml dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -Dmdep.copyPom=true -DoutputDirectory=/maven-repository && cd /root/.m2/repository && find . -name '*.pom' -exec cp --parents -t /maven-repository {} +

FROM gcr.io/distroless/base-debian11
COPY --from=build --link --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
COPY --from=maven-deps /root/.m2/repository /maven-repository
COPY --from=maven-deps /maven-repository /maven-repository
USER nobody
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
Loading
Loading