Skip to content

Commit c390969

Browse files
update Dockerfile for kafka
1 parent d3c5d15 commit c390969

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Dockerfile.kafka

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,27 @@ RUN apt-get update && \
3535
WORKDIR /parseable
3636
COPY Cargo.toml Cargo.lock build.rs ./
3737

38-
# Create a dummy main.rs to pre-cache dependencies
39-
RUN mkdir src && echo "fn main() {}" > src/main.rs && \
40-
cargo build --release --features kafka && \
38+
# Fix librdkafka CMakeLists.txt before building
39+
RUN mkdir -p src && echo "fn main() {}" > src/main.rs && \
40+
# Download the package so it's in the cargo registry
41+
cargo fetch && \
42+
# Find rdkafka-sys directory
43+
RDKAFKA_SYS_DIR=$(find /usr/local/cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1) && \
44+
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR" && \
45+
# Find the CMakeLists.txt file
46+
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt" && \
47+
if [ -f "$CMAKE_FILE" ]; then \
48+
echo "Found CMakeLists.txt at: $CMAKE_FILE" && \
49+
# Replace the minimum required version
50+
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE" && \
51+
echo "Modified CMakeLists.txt to use CMake 3.5 minimum version"; \
52+
else \
53+
echo "Could not find librdkafka CMakeLists.txt file!" && \
54+
exit 1; \
55+
fi
56+
57+
# Now build dependencies with the fixed CMakeLists.txt
58+
RUN cargo build --release --features kafka && \
4159
rm -rf src
4260

4361
# Copy the actual source code

0 commit comments

Comments
 (0)