Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

currencyservice: bring back multistage build #1276

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ release.

## Unreleased

* [currencyservice] bring back multistage build
([#1276](https://github.com/open-telemetry/opentelemetry-demo/pull/1276))
* update loadgenerator dependencies and the base image
([#1274](https://github.com/open-telemetry/opentelemetry-demo/pull/1274))
* add env var for pinning trace-based test tool version
Expand Down
27 changes: 16 additions & 11 deletions src/currencyservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM alpine
FROM alpine as builder

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

ARG OPENTELEMETRY_CPP_VERSION=1.10.0
julianocosta89 marked this conversation as resolved.
Show resolved Hide resolved

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

COPY . /currencyservice

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


FROM alpine as release

RUN apk update && apk add grpc-dev protobuf-dev
COPY --from=builder /usr/local /usr/local

EXPOSE ${CURRENCY_SERVICE_PORT}
ENTRYPOINT ./usr/local/bin/currencyservice ${CURRENCY_SERVICE_PORT}
Loading