diff --git a/Dockerfile b/Dockerfile index cedba5b..043e8bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ -FROM gentoo/portage:latest as portage -FROM liftm/gentoo-uclibc:static as builder -COPY --from=portage /usr/portage /usr/portage +FROM debian:buster as builder -RUN emerge --autounmask-write --autounmask-continue --tree --verbose \ - kafkacat meson dev-util/ninja app-arch/zstd app-arch/lz4 dev-libs/cyrus-sasl jq +RUN apt update \ + && apt install -y \ + jq \ + build-essential pkg-config \ + libssl-dev libsasl2-dev \ + meson ninja-build \ + wget ca-certificates \ + musl-tools WORKDIR /opt/kafkacat COPY . . @@ -11,9 +15,10 @@ RUN true \ && ver=$(sed -rn "H;1h;\$!d;x;s/^.*project\([^)]*kafkacat[^)]*version:[ \t]*'([^']+)'.*$/\1/p" meson.build) \ && wget https://github.com/edenhill/kafkacat/archive/$ver.tar.gz -O/opt/src.tgz \ && tar --strip-components=1 -xvf /opt/src.tgz \ - && meson build --wrap-mode forcefallback -Ddefault_library=static -Dstatic=true \ - && test "$(meson introspect --projectinfo build | jq -r .version)" == $ver \ - && ninja -C build kafkacat \ + && CC=musl-gcc meson build --wrap-mode forcefallback \ + -Ddefault_library=static -Dstatic=true -Drdkafka:WITH_SSL=disabled -Drdkafka:WITH_SASL=disabled \ + && /usr/bin/test "$(meson introspect --projectinfo build | jq -r .version)" == $ver \ + && ninja -Cbuild kafkacat \ && ldd build/kafkacat | grep -q 'not.*dynamic' FROM scratch diff --git a/debian.Dockerfile b/debian.Dockerfile deleted file mode 100644 index 043e8bf..0000000 --- a/debian.Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM debian:buster as builder - -RUN apt update \ - && apt install -y \ - jq \ - build-essential pkg-config \ - libssl-dev libsasl2-dev \ - meson ninja-build \ - wget ca-certificates \ - musl-tools - -WORKDIR /opt/kafkacat -COPY . . -RUN true \ - && ver=$(sed -rn "H;1h;\$!d;x;s/^.*project\([^)]*kafkacat[^)]*version:[ \t]*'([^']+)'.*$/\1/p" meson.build) \ - && wget https://github.com/edenhill/kafkacat/archive/$ver.tar.gz -O/opt/src.tgz \ - && tar --strip-components=1 -xvf /opt/src.tgz \ - && CC=musl-gcc meson build --wrap-mode forcefallback \ - -Ddefault_library=static -Dstatic=true -Drdkafka:WITH_SSL=disabled -Drdkafka:WITH_SASL=disabled \ - && /usr/bin/test "$(meson introspect --projectinfo build | jq -r .version)" == $ver \ - && ninja -Cbuild kafkacat \ - && ldd build/kafkacat | grep -q 'not.*dynamic' - -FROM scratch -USER 1000 -ENTRYPOINT ["/kafkacat"] -COPY --from=builder /opt/kafkacat/build/kafkacat / diff --git a/gentoo-uclibc-with-ssl.Dockerfile b/gentoo-uclibc-with-ssl.Dockerfile new file mode 100644 index 0000000..cedba5b --- /dev/null +++ b/gentoo-uclibc-with-ssl.Dockerfile @@ -0,0 +1,22 @@ +FROM gentoo/portage:latest as portage +FROM liftm/gentoo-uclibc:static as builder +COPY --from=portage /usr/portage /usr/portage + +RUN emerge --autounmask-write --autounmask-continue --tree --verbose \ + kafkacat meson dev-util/ninja app-arch/zstd app-arch/lz4 dev-libs/cyrus-sasl jq + +WORKDIR /opt/kafkacat +COPY . . +RUN true \ + && ver=$(sed -rn "H;1h;\$!d;x;s/^.*project\([^)]*kafkacat[^)]*version:[ \t]*'([^']+)'.*$/\1/p" meson.build) \ + && wget https://github.com/edenhill/kafkacat/archive/$ver.tar.gz -O/opt/src.tgz \ + && tar --strip-components=1 -xvf /opt/src.tgz \ + && meson build --wrap-mode forcefallback -Ddefault_library=static -Dstatic=true \ + && test "$(meson introspect --projectinfo build | jq -r .version)" == $ver \ + && ninja -C build kafkacat \ + && ldd build/kafkacat | grep -q 'not.*dynamic' + +FROM scratch +USER 1000 +ENTRYPOINT ["/kafkacat"] +COPY --from=builder /opt/kafkacat/build/kafkacat /