-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
Dockerfile
274 lines (209 loc) · 8.68 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# -- fluent-bit-package -----------------------------------------------------------
FROM debian:bookworm-slim AS fluent-bit-package
ENV CC="gcc-12" \
CXX="g -12"
WORKDIR /tmp/fluent-bit
COPY scripts/debian/build-fluent-bit.sh ./scripts/debian/
RUN ./scripts/debian/build-fluent-bit.sh && \
rm -rf /var/lib/apt/lists/*
# -- dependencies --------------------------------------------------------------
FROM debian:bookworm-slim AS dependencies
LABEL maintainer="[email protected]"
ENV CC="gcc-12" \
CXX="g -12"
WORKDIR /tmp/tenzir
COPY --from=fluent-bit-package /root/fluent-bit_*.deb /root/
COPY scripts/debian/install-dev-dependencies.sh ./scripts/debian/
RUN ./scripts/debian/install-dev-dependencies.sh && \
apt-get -y --no-install-recommends install /root/fluent-bit_*.deb && \
rm /root/fluent-bit_*.deb && \
rm -rf /var/lib/apt/lists/*
# Tenzir
COPY changelog ./changelog
COPY cmake ./cmake
COPY libtenzir ./libtenzir
COPY libtenzir_test ./libtenzir_test
COPY plugins ./plugins
COPY python ./python
COPY schema ./schema
COPY scripts ./scripts
COPY tenzir ./tenzir
COPY CMakeLists.txt LICENSE README.md tenzir.spdx.json VERSIONING.md \
tenzir.yaml.example version.json ./
# -- development ---------------------------------------------------------------
FROM dependencies AS development
ENV PREFIX="/opt/tenzir" \
PATH="/opt/tenzir/bin:${PATH}" \
CC="gcc-12" \
CXX="g -12"
# When changing these, make sure to also update the corresponding entries in the
# flake.nix file.
ENV TENZIR_CACHE_DIRECTORY="/var/cache/tenzir" \
TENZIR_STATE_DIRECTORY="/var/lib/tenzir" \
TENZIR_LOG_FILE="/var/log/tenzir/server.log" \
TENZIR_ENDPOINT="0.0.0.0"
# Additional arguments to be passed to CMake.
ARG TENZIR_BUILD_OPTIONS
RUN cmake -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" \
-D CMAKE_BUILD_TYPE:STRING="Release" \
-D TENZIR_ENABLE_AVX_INSTRUCTIONS:BOOL="OFF" \
-D TENZIR_ENABLE_AVX2_INSTRUCTIONS:BOOL="OFF" \
-D TENZIR_ENABLE_UNIT_TESTS:BOOL="OFF" \
-D TENZIR_ENABLE_DEVELOPER_MODE:BOOL="OFF" \
-D TENZIR_ENABLE_BUNDLED_CAF:BOOL="ON" \
-D TENZIR_ENABLE_BUNDLED_SIMDJSON:BOOL="ON" \
-D TENZIR_ENABLE_MANPAGES:BOOL="OFF" \
-D TENZIR_ENABLE_PYTHON_BINDINGS_DEPENDENCIES:BOOL="ON" \
${TENZIR_BUILD_OPTIONS} && \
cmake --build build --parallel && \
cmake --install build --strip && \
rm -rf build
RUN mkdir -p \
$PREFIX/etc/tenzir \
/var/cache/tenzir \
/var/lib/tenzir \
/var/log/tenzir
EXPOSE 5158/tcp
WORKDIR /var/lib/tenzir
VOLUME ["/var/lib/tenzir"]
ENTRYPOINT ["tenzir"]
CMD ["--help"]
# -- tenzir-de -----------------------------------------------------------------
FROM debian:bookworm-slim AS tenzir-de
# When changing these, make sure to also update the entries in the flake.nix
# file.
ENV PREFIX="/opt/tenzir" \
PATH="/opt/tenzir/bin:${PATH}" \
TENZIR_CACHE_DIRECTORY="/var/cache/tenzir" \
TENZIR_STATE_DIRECTORY="/var/lib/tenzir" \
TENZIR_LOG_FILE="/var/log/tenzir/server.log" \
TENZIR_ENDPOINT="0.0.0.0"
RUN useradd --system --user-group tenzir
COPY --from=development --chown=tenzir:tenzir $PREFIX/ $PREFIX/
COPY --from=development --chown=tenzir:tenzir /var/cache/tenzir/ /var/cache/tenzir/
COPY --from=development --chown=tenzir:tenzir /var/lib/tenzir/ /var/lib/tenzir/
COPY --from=development --chown=tenzir:tenzir /var/log/tenzir/ /var/log/tenzir/
COPY --from=fluent-bit-package /root/fluent-bit_*.deb /root/
RUN apt-get update && \
apt-get -y --no-install-recommends install \
ca-certificates \
gnupg2 \
libasan6 \
libboost-filesystem 1.81 \
libboost-url1.81 \
libc 1 \
libc abi1 \
libflatbuffers2 \
libfmt9 \
libgrpc 1.51 \
libhttp-parser2.9 \
libmaxminddb0 \
libpcap0.8 \
libprotobuf32 \
librabbitmq4 \
librdkafka 1 \
libre2-9 \
libspdlog1.10 \
libunwind8 \
libxxhash-dev \
libyaml-cpp0.7 \
libyara9 \
libzmq5 \
lsb-release \
openssl \
python3 \
python3-venv \
robin-map-dev \
wget && \
wget "https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb" && \
apt-get -y --no-install-recommends install \
./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
apt-get update && \
apt-get -y --no-install-recommends install libarrow1500 libparquet1500 && \
apt-get -y --no-install-recommends install /root/fluent-bit_*.deb && \
rm /root/fluent-bit_*.deb && \
rm -rf /var/lib/apt/lists/*
USER tenzir:tenzir
EXPOSE 5158/tcp
WORKDIR /var/lib/tenzir
VOLUME ["/var/cache/tenzir", "/var/lib/tenzir"]
# Verify that Tenzir starts up correctly.
RUN tenzir 'version'
ENTRYPOINT ["tenzir"]
CMD ["--help"]
# -- tenzir-node-de ------------------------------------------------------------
FROM tenzir-de AS tenzir-node-de
ENTRYPOINT ["tenzir-node"]
# -- plugins -------------------------------------------------------------------
FROM development AS plugins-source
WORKDIR /tmp/tenzir
COPY contrib/tenzir-plugins ./contrib/tenzir-plugins
FROM plugins-source AS compaction-plugin
RUN cmake -S contrib/tenzir-plugins/compaction -B build-compaction -G Ninja \
-D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" && \
cmake --build build-compaction --parallel && \
DESTDIR=/plugin/compaction cmake --install build-compaction --strip --component Runtime && \
rm -rf build-compaction
FROM plugins-source AS context-plugin
RUN cmake -S contrib/tenzir-plugins/context -B build-context -G Ninja \
-D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" && \
cmake --build build-context --parallel && \
DESTDIR=/plugin/context cmake --install build-context --strip --component Runtime && \
rm -rf build-context
FROM plugins-source AS matcher-plugin
RUN cmake -S contrib/tenzir-plugins/matcher -B build-matcher -G Ninja \
-D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" && \
cmake --build build-matcher --parallel && \
DESTDIR=/plugin/matcher cmake --install build-matcher --strip --component Runtime && \
rm -rf build-matcher
FROM plugins-source AS pipeline-manager-plugin
RUN cmake -S contrib/tenzir-plugins/pipeline-manager -B build-pipeline-manager -G Ninja \
-D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" && \
cmake --build build-pipeline-manager --parallel && \
DESTDIR=/plugin/pipeline-manager cmake --install build-pipeline-manager --strip --component Runtime && \
rm -rf build-pipeline-manager
FROM plugins-source AS platform-plugin
RUN cmake -S contrib/tenzir-plugins/platform -B build-platform -G Ninja \
-D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" && \
cmake --build build-platform --parallel && \
DESTDIR=/plugin/platform cmake --install build-platform --strip --component Runtime && \
rm -rf build-platform
# -- tenzir-ce -------------------------------------------------------------------
FROM tenzir-de AS tenzir-ce
COPY --from=context-plugin --chown=tenzir:tenzir /plugin/context /
COPY --from=matcher-plugin --chown=tenzir:tenzir /plugin/matcher /
COPY --from=pipeline-manager-plugin --chown=tenzir:tenzir /plugin/pipeline-manager /
COPY --from=platform-plugin --chown=tenzir:tenzir /plugin/platform /
# -- tenzir-node-ce ------------------------------------------------------------
FROM tenzir-ce AS tenzir-node-ce
ENTRYPOINT ["tenzir-node"]
# -- tenzir-demo --------------------------------------------------------------
FROM tenzir-ce AS tenzir-demo
USER root
RUN apt-get update && \
apt-get -y --no-install-recommends install jq lsof && \
rm -rf /var/lib/apt/lists/*
USER tenzir:tenzir
COPY demo-node /demo-node
COPY --from=tenzir-ce --chown=tenzir:tenzir \
/var/cache/tenzir \
/var/lib/tenzir/ \
/var/log/tenzir
ENV TENZIR_AUTOMATIC_REBUILD=0 \
TENZIR_ALLOW_UNSAFE_PIPELINES=true
RUN /demo-node/setup.bash
ENTRYPOINT ["tenzir-node"]
# -- tenzir-ee -------------------------------------------------------------------
FROM tenzir-ce AS tenzir-ee
COPY --from=compaction-plugin --chown=tenzir:tenzir /plugin/compaction /
COPY --from=context-plugin --chown=tenzir:tenzir /plugin/context /
# -- tenzir-node-ee ------------------------------------------------------------
FROM tenzir-ee AS tenzir-node-ee
ENTRYPOINT ["tenzir-node"]
# -- tenzir-node -----------------------------------------------------------------
FROM tenzir-node-ce AS tenzir-node
# -- tenzir ----------------------------------------------------------------------
# As a last stage we re-introduce the community edition as tenzir so that it's
# the default when not specifying a build target.
FROM tenzir-ce AS tenzir