xref: /aosp_15_r20/external/grpc-grpc-java/buildscripts/observability-test/Dockerfile (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1# Copyright 2023 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#
17# Stage 1: Build the interop test client and server
18#
19
20FROM eclipse-temurin:11-jdk AS build
21
22WORKDIR /grpc-java
23COPY . .
24
25RUN ./gradlew :grpc-gcp-observability:interop:installDist -PskipCodegen=true -PskipAndroid=true
26
27
28#
29# Stage 2:
30#
31# - Copy only the necessary files to reduce Docker image size.
32# - Have an ENTRYPOINT script which will launch the interop test client or server
33#   with the given parameters.
34#
35
36FROM eclipse-temurin:11-jre
37
38WORKDIR /grpc-java/
39COPY --from=build /grpc-java/gcp-observability/interop/build/install/interop/. .
40
41WORKDIR /grpc-java/buildscripts/observability-test
42COPY --from=build /grpc-java/buildscripts/observability-test/run.sh .
43
44# Intentionally after the app COPY to force the update on each build.
45# Update Ubuntu system packages:
46RUN apt-get update \
47    && apt-get -y upgrade \
48    && apt-get -y autoremove \
49    && rm -rf /var/lib/apt/lists/*
50
51ENTRYPOINT ["/grpc-java/buildscripts/observability-test/run.sh"]
52