diff --git a/packages/cpp/tools/packaging/make-deb.sh b/packages/cpp/tools/packaging/make-deb.sh index c052d4332..431171d45 100755 --- a/packages/cpp/tools/packaging/make-deb.sh +++ b/packages/cpp/tools/packaging/make-deb.sh @@ -2,5 +2,5 @@ set -x script_path="$(readlink -f "${BASH_SOURCE:-$0}")" script_dir="$(dirname "$script_path")" -docker build -t "debbuild" -f deb.Dockerfile --progress=plain "${script_dir}/../../../.." +docker buildx build -t "debbuild" -f deb.Dockerfile --progress=plain "${script_dir}/../../../.." docker run --rm -v ".:/host" --entrypoint bash "debbuild" -c "cp ./*.deb /host/" diff --git a/packages/cpp/tools/packaging/make-rpm.sh b/packages/cpp/tools/packaging/make-rpm.sh index 7c38d7414..0a2932f0f 100755 --- a/packages/cpp/tools/packaging/make-rpm.sh +++ b/packages/cpp/tools/packaging/make-rpm.sh @@ -2,5 +2,5 @@ set -x script_path="$(readlink -f "${BASH_SOURCE:-$0}")" script_dir="$(dirname "$script_path")" -docker build -t "rpmbuild" -f ubi7.Dockerfile --progress=plain "${script_dir}/../../../.." +docker buildx build -t "rpmbuild" -f ubi7.Dockerfile --progress=plain "${script_dir}/../../../.." docker run --rm -v ".:/host" --entrypoint bash "rpmbuild" -c "cp /rpm/build/*.rpm /host/" diff --git a/packages/cpp/tools/packaging/make-tar.gz.sh b/packages/cpp/tools/packaging/make-tar.gz.sh index 37da42b46..2953450da 100755 --- a/packages/cpp/tools/packaging/make-tar.gz.sh +++ b/packages/cpp/tools/packaging/make-tar.gz.sh @@ -1,5 +1,7 @@ #!/bin/sh set -ex -../compile.sh -cp ../../build/*.tar.gz . +script_path="$(readlink -f "${BASH_SOURCE:-$0}")" +script_dir="$(dirname "$script_path")" +docker buildx build -t "tgzalpinebuild" -f "${script_dir}/tgz_alpine.Dockerfile" --progress=plain "${script_dir}/../../../.." +docker run --rm -v ".:/host" --entrypoint sh "tgzalpinebuild" -c "cp ./*.tar.gz /host/" diff --git a/packages/cpp/tools/packaging/tgz_alpine.Dockerfile b/packages/cpp/tools/packaging/tgz_alpine.Dockerfile new file mode 100644 index 000000000..958c7d506 --- /dev/null +++ b/packages/cpp/tools/packaging/tgz_alpine.Dockerfile @@ -0,0 +1,51 @@ +# Start with the latest Alpine base image for the build stage +FROM alpine AS builder +ARG GRPC_VERSION=v1.54.0 + +# Install all the necessary dependencies required for the build process +# These include tools and libraries for building and compiling the source code +RUN apk update && apk add --no-cache \ + git \ + gcc \ + g++ \ + build-base \ + autoconf \ + automake \ + libtool \ + curl \ + c-ares \ + c-ares-dev \ + make \ + cmake \ + unzip \ + linux-headers \ + grpc \ + grpc-dev \ + protobuf \ + protobuf-dev + +# Update the PATH environment variable to include the gRPC libraries and binaries +ENV LD_LIBRARY_PATH="/app/install/lib:$LD_LIBRARY_PATH" +ENV PATH="/app/install/bin:$PATH" + +# Display the updated PATH environment variable +RUN echo $PATH + +# Copy the application source files into the image +WORKDIR /app/libarmonik +COPY packages/cpp/tools/packaging/common/. ./tools/packaging/common/ +COPY Protos/V1/. ./Protos/ +COPY packages/cpp/ArmoniK.Api.Common/. ./ArmoniK.Api.Common/ +COPY packages/cpp/ArmoniK.Api.Client/. ./ArmoniK.Api.Client/ +COPY packages/cpp/ArmoniK.Api.Worker/. ./ArmoniK.Api.Worker/ +COPY packages/cpp/CMakeLists.txt . +COPY packages/cpp/Packaging.cmake . +COPY packages/cpp/Dependencies.cmake . + +# Build the application using the copied source files and protobuf definitions +WORKDIR /app/libarmonik/build +RUN cmake -DCMAKE_INSTALL_PREFIX="/app/install" -DPROTO_FILES_DIR="/app/proto" -DBUILD_TEST=OFF \ + -DBUILD_CLIENT=ON -DBUILD_WORKER=OFF -DPROTO_FILES_DIR=/app/libarmonik/Protos \ + -DCPACK_GENERATOR=TGZ /app/libarmonik && \ + make -j $(nproc) && \ + make package -j