xref: /aosp_15_r20/external/grpc-grpc-java/buildscripts/observability-test/Dockerfile (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1*e07d83d3SAndroid Build Coastguard Worker# Copyright 2023 gRPC authors.
2*e07d83d3SAndroid Build Coastguard Worker#
3*e07d83d3SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*e07d83d3SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*e07d83d3SAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*e07d83d3SAndroid Build Coastguard Worker#
7*e07d83d3SAndroid Build Coastguard Worker#     http://www.apache.org/licenses/LICENSE-2.0
8*e07d83d3SAndroid Build Coastguard Worker#
9*e07d83d3SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*e07d83d3SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*e07d83d3SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*e07d83d3SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*e07d83d3SAndroid Build Coastguard Worker# limitations under the License.
14*e07d83d3SAndroid Build Coastguard Worker
15*e07d83d3SAndroid Build Coastguard Worker
16*e07d83d3SAndroid Build Coastguard Worker#
17*e07d83d3SAndroid Build Coastguard Worker# Stage 1: Build the interop test client and server
18*e07d83d3SAndroid Build Coastguard Worker#
19*e07d83d3SAndroid Build Coastguard Worker
20*e07d83d3SAndroid Build Coastguard WorkerFROM eclipse-temurin:11-jdk AS build
21*e07d83d3SAndroid Build Coastguard Worker
22*e07d83d3SAndroid Build Coastguard WorkerWORKDIR /grpc-java
23*e07d83d3SAndroid Build Coastguard WorkerCOPY . .
24*e07d83d3SAndroid Build Coastguard Worker
25*e07d83d3SAndroid Build Coastguard WorkerRUN ./gradlew :grpc-gcp-observability:interop:installDist -PskipCodegen=true -PskipAndroid=true
26*e07d83d3SAndroid Build Coastguard Worker
27*e07d83d3SAndroid Build Coastguard Worker
28*e07d83d3SAndroid Build Coastguard Worker#
29*e07d83d3SAndroid Build Coastguard Worker# Stage 2:
30*e07d83d3SAndroid Build Coastguard Worker#
31*e07d83d3SAndroid Build Coastguard Worker# - Copy only the necessary files to reduce Docker image size.
32*e07d83d3SAndroid Build Coastguard Worker# - Have an ENTRYPOINT script which will launch the interop test client or server
33*e07d83d3SAndroid Build Coastguard Worker#   with the given parameters.
34*e07d83d3SAndroid Build Coastguard Worker#
35*e07d83d3SAndroid Build Coastguard Worker
36*e07d83d3SAndroid Build Coastguard WorkerFROM eclipse-temurin:11-jre
37*e07d83d3SAndroid Build Coastguard Worker
38*e07d83d3SAndroid Build Coastguard WorkerWORKDIR /grpc-java/
39*e07d83d3SAndroid Build Coastguard WorkerCOPY --from=build /grpc-java/gcp-observability/interop/build/install/interop/. .
40*e07d83d3SAndroid Build Coastguard Worker
41*e07d83d3SAndroid Build Coastguard WorkerWORKDIR /grpc-java/buildscripts/observability-test
42*e07d83d3SAndroid Build Coastguard WorkerCOPY --from=build /grpc-java/buildscripts/observability-test/run.sh .
43*e07d83d3SAndroid Build Coastguard Worker
44*e07d83d3SAndroid Build Coastguard Worker# Intentionally after the app COPY to force the update on each build.
45*e07d83d3SAndroid Build Coastguard Worker# Update Ubuntu system packages:
46*e07d83d3SAndroid Build Coastguard WorkerRUN apt-get update \
47*e07d83d3SAndroid Build Coastguard Worker    && apt-get -y upgrade \
48*e07d83d3SAndroid Build Coastguard Worker    && apt-get -y autoremove \
49*e07d83d3SAndroid Build Coastguard Worker    && rm -rf /var/lib/apt/lists/*
50*e07d83d3SAndroid Build Coastguard Worker
51*e07d83d3SAndroid Build Coastguard WorkerENTRYPOINT ["/grpc-java/buildscripts/observability-test/run.sh"]
52