Skip to content

Commit 8cfba6e

Browse files
committed
currencyservice: bring back multistage build (open-telemetry#1276)
1 parent 2a5ebad commit 8cfba6e

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ release.
77

88
## Unreleased
99

10+
* [currencyservice] bring back multistage build
11+
([#1276](https://github.com/open-telemetry/opentelemetry-demo/pull/1276))
1012
* [currencyservice]: update opentelemetry-cpp to 1.12.0
1113
([#1275](https://github.com/open-telemetry/opentelemetry-demo/pull/1275))
1214
* update loadgenerator dependencies and the base image

src/currencyservice/Dockerfile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
FROM alpine
17+
FROM alpine as builder
1818

19-
RUN apk update
20-
RUN apk add git cmake make g++ grpc-dev re2-dev protobuf-dev c-ares-dev
19+
RUN apk update && apk add git cmake make g++ grpc-dev protobuf-dev
2120

2221
ARG OPENTELEMETRY_CPP_VERSION=1.12.0
2322

2423
RUN git clone https://github.com/open-telemetry/opentelemetry-cpp \
25-
&& cd opentelemetry-cpp/ \
26-
&& git checkout tags/v${OPENTELEMETRY_CPP_VERSION} -b v${OPENTELEMETRY_CPP_VERSION} \
27-
&& mkdir build \
28-
&& cd build \
29-
&& cmake .. -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
30-
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \
31-
-DWITH_EXAMPLES=OFF -DWITH_OTLP_GRPC=ON \
32-
&& make -j$(nproc || sysctl -n hw.ncpu || echo 1) install && cd ../.. && rm -rf opentelemetry-cpp
24+
&& cd opentelemetry-cpp/ \
25+
&& git checkout tags/v${OPENTELEMETRY_CPP_VERSION} -b v${OPENTELEMETRY_CPP_VERSION} \
26+
&& mkdir build \
27+
&& cd build \
28+
&& cmake .. -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
29+
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \
30+
-DWITH_EXAMPLES=OFF -DWITH_OTLP_GRPC=ON \
31+
&& make -j$(nproc || sysctl -n hw.ncpu || echo 1) install && cd ../..
3332

3433
COPY . /currencyservice
3534

@@ -38,5 +37,11 @@ RUN cd /currencyservice \
3837
&& cmake .. \
3938
&& make -j$(nproc || sysctl -n hw.ncpu || echo 1) install
4039

40+
41+
FROM alpine as release
42+
43+
RUN apk update && apk add grpc-dev protobuf-dev
44+
COPY --from=builder /usr/local /usr/local
45+
4146
EXPOSE ${CURRENCY_SERVICE_PORT}
4247
ENTRYPOINT ./usr/local/bin/currencyservice ${CURRENCY_SERVICE_PORT}

0 commit comments

Comments
 (0)