FROM ubuntu:20.04 as builder ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y git wget libssl-dev libsasl2-dev gcc g++ make zlib1g-dev libzstd-dev python3 pkg-config \ && git clone https://github.com/edenhill/librdkafka && cd librdkafka \ && ./configure --install-deps --disable-regex-ext \ && make && make install && wget https://golang.org/dl/go1.16.7.linux-amd64.tar.gz \ && tar -C /usr/local -xzf go1.16.7.linux-amd64.tar.gz WORKDIR /app COPY . . RUN PATH=$PATH:/usr/local/go/bin; go build -tags dynamic -o speedy . FROM ubuntu:20.04 COPY --from=builder /app /app COPY --from=builder /librdkafka/src/librdkafka.so.1 /usr/lib/x86_64-linux-gnu/librdkafka.so.1 COPY --from=builder /librdkafka/src/librdkafka.so /usr/lib/x86_64-linux-gnu/librdkafka.so COPY --from=builder /usr/lib/x86_64-linux-gnu/libsasl2.so.2 /usr/lib/x86_64-linux-gnu/libsasl2.so.2 COPY --from=builder /usr/lib/x86_64-linux-gnu/libssl.so.1.1 /usr/lib/x86_64-linux-gnu/libssl.so.1.1 COPY --from=builder /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ENTRYPOINT [ "/app/speedy" ]