-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
107 lines (86 loc) · 4.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Arguments for DEV's (comment static FROM and uncomnnet #DEV ones)
ARG UBI_VERSION=9
ARG UBI_BUILD_TAG=latest
ARG UBI_RUNTIME_TAG=latest
ARG IMAGE_BUILD=registry.access.redhat.com/ubi${UBI_VERSION}/ubi-minimal:${UBI_TAG}
ARG IMAGE_BASE=registry.access.redhat.com/ubi${UBI_VERSION}/ubi-minimal:${UBI_RUNTIME_TAG}
# Build this with something like buildah bud --arch arm64 --volume=/tmp/ccache:/ccache
#DEV FROM $IMAGE_BUILD
FROM quay.io/centos/centos:stream9 as build
ENV PROTON_VERSION=0.39.0
RUN curl -OL https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
RUN rpm -ivh epel-release-latest-9.noarch.rpm
RUN dnf install -y 'dnf-command(config-manager)'
RUN /usr/bin/crb enable
RUN curl -L https://copr.fedorainfracloud.org/coprs/kpvdr/opentelemetry-cpp-rhel/repo/epel-9/kpvdr-opentelemetry-cpp-rhel-epel-9.repo > /etc/yum.repos.d/kpvdr-opentelemetry-cpp-rhel-epel-9.repo
RUN curl -L https://copr.fedorainfracloud.org/coprs/kpvdr/protobuf/repo/epel-9/kpvdr-protobuf-epel-9.repo > /etc/yum.repos.d/kpvdr-protobuf-epel-9.repo
RUN curl -L https://copr.fedorainfracloud.org/coprs/kpvdr/json/repo/epel-9/kpvdr-json-epel-9.repo > /etc/yum.repos.d/kpvdr-json-epel-9.repo
#CMake Error at /usr/lib64/cmake/protobuf/protobuf-targets.cmake:106 (message):
# The imported target "protobuf::libprotobuf-lite" references the file
#
# "/usr/lib64/libprotobuf-lite.so.3.19.6.0"
RUN dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install \
ccache findutils git patchelf \
\
cmake ninja-build \
gcc gcc-c++ \
\
protobuf-lite-devel \
\
opentelemetry-cpp-devel \
opentelemetry-cpp-exporter-otlp-devel \
opentelemetry-cpp-zpages-devel \
\
cyrus-sasl-devel \
openssl-devel \
python-devel
COPY . /src
WORKDIR /src
# can't put $(arch) to CCACHE_DIR, https://github.com/moby/moby/issues/29110
# ENV CCACHE_DIR=
ENV CCACHE_COMPRESS=true
ENV CCACHE_MAXSIZE=400MB
RUN git clone --branch=${PROTON_VERSION} --depth=1 https://github.com/apache/qpid-proton.git
RUN CCACHE_DIR=/ccache/$(arch) cmake -S qpid-proton -B cmake-build-qpid-proton -GNinja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=cmake-install \
-DBUILD_BINDINGS=cpp \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
-DSASL_IMPL=cyrus \
-DSSL_IMPL=openssl \
-DPROACTOR=epoll
RUN CCACHE_DIR=/ccache/$(arch) cmake --build cmake-build-qpid-proton
RUN CCACHE_DIR=/ccache/$(arch) cmake --install cmake-build-qpid-proton --config RelWithDebInfo
RUN CCACHE_DIR=/ccache/$(arch) cmake -S . -B cmake-build-cli-cpp -GNinja \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_INSTALL_PREFIX=cmake-install
#-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \
#-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE
RUN CCACHE_DIR=/ccache/$(arch) cmake --build cmake-build-cli-cpp
RUN CCACHE_DIR=/ccache/$(arch) cmake --install cmake-build-cli-cpp --config RelWithDebInfo
# fixup finding the proton library, this is something that our build should handle by itself, though
RUN for i in cmake-install/bin/*; do patchelf --add-rpath /usr/local/lib64 $i; done
FROM quay.io/centos/centos:stream9
RUN curl -OL https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
RUN rpm -ivh epel-release-latest-9.noarch.rpm
RUN dnf install -y 'dnf-command(config-manager)'
RUN /usr/bin/crb enable
RUN curl -L https://copr.fedorainfracloud.org/coprs/kpvdr/opentelemetry-cpp-rhel/repo/epel-9/kpvdr-opentelemetry-cpp-rhel-epel-9.repo > /etc/yum.repos.d/kpvdr-opentelemetry-cpp-rhel-epel-9.repo
RUN curl -L https://copr.fedorainfracloud.org/coprs/kpvdr/protobuf/repo/epel-9/kpvdr-protobuf-epel-9.repo > /etc/yum.repos.d/kpvdr-protobuf-epel-9.repo
RUN curl -L https://copr.fedorainfracloud.org/coprs/kpvdr/json/repo/epel-9/kpvdr-json-epel-9.repo > /etc/yum.repos.d/kpvdr-json-epel-9.repo
RUN dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install \
protobuf-lite \
opentelemetry-cpp opentelemetry-cpp-exporter-otlp opentelemetry-cpp-zpages \
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-lib cyrus-sasl-plain \
openssl
COPY --from=build /src/cmake-install/ /usr/local
RUN mkdir /var/lib/cli-cpp && \
chown -R 1001:0 /var/lib/cli-cpp && \
chmod -R g=u /var/lib/cli-cpp
USER 1001
VOLUME /var/lib/cli-cpp
WORKDIR /var/lib/cli-cpp
CMD ["/bin/bash"]