Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add Docker fiels for xds example server and client.
  • Loading branch information
kannanjgithub committed Mar 23, 2026
commit 7c45aac5efa86584d0dc3264de0efd5be69fc612
47 changes: 47 additions & 0 deletions examples/example-xds/xds-client.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Stage 1: Build XDS client
#

FROM eclipse-temurin:11-jdk AS build

WORKDIR /grpc-java/examples
COPY . .

RUN cd example-xds && ../gradlew installDist -PskipCodegen=true -PskipAndroid=true

#
# Stage 2:
#
# - Copy only the necessary files to reduce Docker image size.
# - Have an ENTRYPOINT script which will launch the XDS client
# with the given parameters.
#

FROM eclipse-temurin:11-jre

WORKDIR /grpc-java/
COPY --from=build /grpc-java/examples/example-xds/build/install/example-xds/. .

# Intentionally after the COPY to force the update on each build.
# Update Ubuntu system packages:
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*

# Client
ENTRYPOINT ["bin/xds-hello-world-client"]
47 changes: 47 additions & 0 deletions examples/example-xds/xds-server.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Stage 1: Build XDS server
#

FROM eclipse-temurin:11-jdk AS build

WORKDIR /grpc-java/examples
COPY . .

RUN cd example-xds && ../gradlew installDist -PskipCodegen=true -PskipAndroid=true

#
# Stage 2:
#
# - Copy only the necessary files to reduce Docker image size.
# - Have an ENTRYPOINT script which will launch the XDS server
# with the given parameters.
#

FROM eclipse-temurin:11-jre

WORKDIR /grpc-java/
COPY --from=build /grpc-java/examples/example-xds/build/install/example-xds/. .

# Intentionally after the COPY to force the update on each build.
# Update Ubuntu system packages:
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*

# Server
ENTRYPOINT ["bin/xds-hello-world-server"]