Skip to content

Commit 1d2cd42

Browse files
esigolalitb
andauthored
dependencies image as artifact (#1333)
Co-authored-by: Lalit Kumar Bhasin <[email protected]>
1 parent 2e9b7a1 commit 1d2cd42

File tree

4 files changed

+110
-4
lines changed

4 files changed

+110
-4
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: 'OpenTelemetry-cpp dependencies image'
2+
on:
3+
schedule:
4+
- cron: "0 3 * * 6"
5+
6+
jobs:
7+
docker_image:
8+
name: Docker Image
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 300
11+
steps:
12+
-
13+
name: checkout
14+
uses: actions/checkout@v2
15+
-
16+
name: Set up QEMU
17+
uses: docker/setup-qemu-action@v1
18+
-
19+
name: Set up Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v1
22+
-
23+
name: Build Image
24+
uses: docker/build-push-action@v2
25+
with:
26+
builder: ${{ steps.buildx.outputs.name }}
27+
context: ci/
28+
file: ./docker/Dockerfile
29+
build-args: BASE_IMAGE=ubuntu:latest
30+
platforms: linux/amd64
31+
# platforms: linux/amd64,linux/arm64
32+
push: false
33+
tags: otel-cpp-deps
34+
load: true
35+
-
36+
name: Save Image
37+
run: |
38+
docker images
39+
docker save -o /opt/otel-cpp-deps-debian.tar otel-cpp-deps
40+
-
41+
name: Upload Image
42+
uses: actions/upload-artifact@v3
43+
with:
44+
name: otel-cpp-deps
45+
path: /opt/otel-cpp-deps-debian.tar
46+
retention-days: 14

ci/setup_grpc.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ new_grpc_version='v1.43.2'
1010
gcc_version_for_new_grpc='5.1'
1111
install_grpc_version=${new_grpc_version}
1212
grpc_version='v1.39.0'
13-
usage() { echo "Usage: $0 -v <gcc-version>" 1>&2; exit 1; }
13+
install_dir='/usr/local/'
14+
usage() { echo "Usage: $0 [-v <gcc-version>] [-i <install_dir>"] 1>&2; exit 1;}
1415

15-
while getopts ":v:" o; do
16+
while getopts ":v:i:" o; do
1617
case "${o}" in
1718
v)
1819
gcc_version=${OPTARG}
1920
;;
21+
i)
22+
install_dir=${OPTARG}
23+
;;
2024
*)
2125
usage
2226
;;
@@ -34,7 +38,7 @@ if ! type cmake > /dev/null; then
3438
exit 1
3539
fi
3640
export BUILD_DIR=/tmp/
37-
export INSTALL_DIR=/usr/local/
41+
export INSTALL_DIR=${install_dir}
3842
pushd $BUILD_DIR
3943
echo "installing grpc version: ${install_grpc_version}"
4044
git clone --depth=1 -b ${install_grpc_version} https://github.com/grpc/grpc

ci/setup_thrift.sh

+14-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@ set -e
44
export DEBIAN_FRONTEND=noninteractive
55
export THRIFT_VERSION=0.14.1
66

7+
install_dir='/usr/local/'
8+
while getopts ":i:" o; do
9+
case "${o}" in
10+
i)
11+
install_dir=${OPTARG}
12+
;;
13+
*)
14+
;;
15+
esac
16+
done
17+
718
apt update
819

920
if ! type cmake > /dev/null; then
1021
#cmake not installed, exiting
1122
exit 1
1223
fi
1324
export BUILD_DIR=/tmp/
14-
export INSTALL_DIR=/usr/local/
25+
export INSTALL_DIR=${install_dir}
1526

1627
apt install -y --no-install-recommends \
1728
libboost-locale-dev \
@@ -44,6 +55,8 @@ cmake -G Ninja .. \
4455
-DWITH_BOOSTTHREADS=OFF \
4556
-DWITH_BOOST_FUNCTIONAL=OFF \
4657
-DWITH_BOOST_SMART_PTR=OFF \
58+
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
59+
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
4760
..
4861

4962
ninja -j $(nproc)

docker/Dockerfile.debian.deps

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
ARG BASE_IMAGE=ubuntu:latest
2+
ARG CORES=${nproc}
3+
4+
FROM ${BASE_IMAGE} as base
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update && apt-get install -y build-essential autoconf \
9+
libtool pkg-config cmake git libssl-dev curl \
10+
libcurl4-openssl-dev libgtest-dev libgmock-dev libbenchmark-dev
11+
12+
WORKDIR /work
13+
RUN mkdir -p /opt/otel-cpp
14+
15+
FROM base as grpc
16+
# install grpc, protobuf and abseil
17+
ARG GRPC_VERSION=1.43.2
18+
19+
ADD setup_grpc.sh .
20+
RUN ./setup_grpc.sh -i "/opt/otel-cpp" -v ${GRPC_VERSION}
21+
22+
FROM base as thrift
23+
RUN apt-get install -y --no-install-recommends wget
24+
25+
# install thrift
26+
ARG THRIFT_VERSION=0.14.1
27+
ADD setup_thrift.sh .
28+
RUN ./setup_thrift.sh -i "/opt/otel-cpp"
29+
30+
FROM scratch as final
31+
32+
COPY --from=grpc /opt/otel-cpp /
33+
COPY --from=thrift /opt/otel-cpp /
34+
35+
# how to use:
36+
#
37+
# docker create -ti --name deps otel-cpp-deps bash
38+
# docker cp deps:/ ./
39+
# docker rm -f deps
40+
#
41+
# or:
42+
#
43+
# COPY --from=otel-cpp-deps /usr

0 commit comments

Comments
 (0)