Skip to content

Commit ed5072e

Browse files
committed
Add Docker fiels for xds example server and client.
1 parent 2fb0957 commit ed5072e

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2024 gRPC authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#
16+
# Stage 1: Build XDS client
17+
#
18+
19+
FROM eclipse-temurin:11-jdk AS build
20+
21+
WORKDIR /grpc-java/examples
22+
COPY . .
23+
24+
RUN cd example-xds && ../gradlew installDist -PskipCodegen=true -PskipAndroid=true
25+
26+
#
27+
# Stage 2:
28+
#
29+
# - Copy only the necessary files to reduce Docker image size.
30+
# - Have an ENTRYPOINT script which will launch the XDS client
31+
# with the given parameters.
32+
#
33+
34+
FROM eclipse-temurin:11-jre
35+
36+
WORKDIR /grpc-java/
37+
COPY --from=build /grpc-java/examples/example-xds/build/install/example-xds/. .
38+
39+
# Intentionally after the COPY to force the update on each build.
40+
# Update Ubuntu system packages:
41+
RUN apt-get update \
42+
&& apt-get -y upgrade \
43+
&& apt-get -y autoremove \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# Client
47+
ENTRYPOINT ["bin/xds-hello-world-client"]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2024 gRPC authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#
16+
# Stage 1: Build XDS server
17+
#
18+
19+
FROM eclipse-temurin:11-jdk AS build
20+
21+
WORKDIR /grpc-java/examples
22+
COPY . .
23+
24+
RUN cd example-xds && ../gradlew installDist -PskipCodegen=true -PskipAndroid=true
25+
26+
#
27+
# Stage 2:
28+
#
29+
# - Copy only the necessary files to reduce Docker image size.
30+
# - Have an ENTRYPOINT script which will launch the XDS server
31+
# with the given parameters.
32+
#
33+
34+
FROM eclipse-temurin:11-jre
35+
36+
WORKDIR /grpc-java/
37+
COPY --from=build /grpc-java/examples/example-xds/build/install/example-xds/. .
38+
39+
# Intentionally after the COPY to force the update on each build.
40+
# Update Ubuntu system packages:
41+
RUN apt-get update \
42+
&& apt-get -y upgrade \
43+
&& apt-get -y autoremove \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# Server
47+
ENTRYPOINT ["bin/xds-hello-world-server"]

0 commit comments

Comments
 (0)