1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-22 20:06:07 +02:00
opentelemetry-go/example/http/Dockerfile

25 lines
925 B
Docker
Raw Normal View History

add Dockerfile and docker-compose.yml to run example code (#635) * add optional server url arg to http client example Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add Dockerfile to build example http images Multi-stage Dockerfile with targets for building example http server and client. $ docker build --tag the-server --target example-http-server . $ docker build --tag the-client --target example-http-client . Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add docker-compose.yml file for running examples This docker compose configuration file will help a new user to compile and run the example code quickly. Uses the Dockerfile to build images with compiled examples. $ docker-compose build http-server http-client $ docker-compose up http-server http-client Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add newline to last message of example http client Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add optional collector url arg to zipkin client example Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add Dockerfile target to build zipkin client For building the example zipkin client: $ docker build --tag zipkin-client --target example-zipkin-client . Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add docker compose service to run zipkin examples Services to run the zipkin client along with a zipkin collector: $ docker-compose build zipkin-client $ docker-compose up zipkin-collector zipkin-client Since the zipkin collector takes a few seconds before it is ready to receive traces, I added a simple retry loop to the client command. The collector service exposes port 9411 so user can visit http//localhost:9411/ to see the trace sent to the collector. Be sure to search by the trace id logged by the client. Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * Update Dockerfile with AL2 declaration As described in https://www.apache.org/licenses/LICENSE-2.0#apply Co-Authored-By: Tyler Yahn <MrAlias@users.noreply.github.com> * Update docker-compose.yml with AL2 declaration As described in https://www.apache.org/licenses/LICENSE-2.0#apply Co-Authored-By: Tyler Yahn <MrAlias@users.noreply.github.com> * pass server url as flag in example http client $ ./client -h Usage of ./client: -server string server url (default "http://localhost:7777/hello") Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * pass zipkin url as flag in example zipkin client $ ./zipkin -h Usage of ./zipkin: -zipkin string zipkin url (default "http://localhost:9411/api/v2/spans") Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * move Dockerfile and docker-compose.yml into example dir Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add Dockerfile and docker-compose.yml for zipkin example Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * update zipkin example README.md With instructions on how to use docker-compose to run the example. Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * add http example README.md With instructions on how to use docker-compose to run the example. Signed-off-by: Andrew Hsu <xuzuan@gmail.com> * Update example/http/Dockerfile WORKDIR Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com> * Update example/http/Dockerfile RUN go install Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com> * Update example/http/Dockerfile RUN go install Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com> * Update example/zipkin/Dockerfile WORKDIR Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com> * Update example/zipkin/Dockerfile RUN go install Co-Authored-By: Krzesimir Nowak <qdlacz@gmail.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Krzesimir Nowak <qdlacz@gmail.com> Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-04-23 22:11:24 +02:00
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:alpine AS base
COPY . /go/src/github.com/open-telemetry/opentelemetry-go/
WORKDIR /go/src/github.com/open-telemetry/opentelemetry-go/example/http/
FROM base AS example-http-server
RUN go install ./server/server.go
CMD ["/go/bin/server"]
FROM base AS example-http-client
RUN go install ./client/client.go
CMD ["/go/bin/client"]