Dockerfile内容如下:
FROM ubuntu:24.04 AS base
RUN apt update
RUN apt install -y libssl-dev
RUN apt install -y openssl
RUN apt install -y unzip
RUN apt install -y git
#builder
FROM base AS builder
RUN apt install -y build-essential
RUN apt install -y cmake
RUN apt install -y ninja-build
RUN apt install -y curl
RUN apt install -y wget
RUN apt install -y autoconf
RUN apt install -y libtool
WORKDIR /opt
RUN git clone -b 1.2.15 GitHub - HardySimpson/zlog: A reliable, high-performance, thread safe, flexsible, clear-model, pure C logging library.
RUN git clone GitHub - neugates/jansson: C library for encoding, decoding and manipulating JSON data
RUN git clone -b v2.16.12 GitHub - Mbed-TLS/mbedtls: An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
RUN git clone -b neuron GitHub - neugates/NanoSDK: NanoSDK - MQTT 5.0-compliant SDK with QUIC support in NNG flavor
RUN git clone -b v1.13.1 GitHub - benmcollins/libjwt: JWT C Library
RUN git clone -b release-1.11.0 GitHub - google/googletest: GoogleTest - Google Testing and Mocking Framework
RUN curl -o sqlite3.tar.gz https://www.sqlite.org/2022/sqlite-autoconf-3390000.tar.gz
RUN wget --no-check-certificate --content-disposition https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protobuf-cpp-3.20.1.tar.gz
RUN git clone -b v1.4.0 GitHub - protobuf-c/protobuf-c: Protocol Buffers implementation in C
RUN git clone -b 2.10.0 GitHub - emqx/neuron: Open source industrial IoT connectivity server
RUN cd zlog && make && make install
RUN cd jansson && mkdir build && cd build && cmake -DJANSSON_BUILD_DOCS=OFF -DJANSSON_EXAMPLES=OFF … && make && make install
RUN cd mbedtls && mkdir build && cd build && cmake -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DENABLE_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON … && make && make install
RUN cd NanoSDK && mkdir build && cd build && cmake -DBUILD_SHARED_LIBS=OFF -DNNG_TESTS=OFF -DNNG_ENABLE_SQLITE=ON -DNNG_ENABLE_TLS=ON … && make && make install
RUN cd libjwt && mkdir build && cd build && cmake -DENABLE_PIC=ON -DBUILD_SHARED_LIBS=OFF … && make && make install
RUN cd googletest && mkdir build && cd build && cmake … && make && make install
RUN mkdir sqlite3 && tar xzf sqlite3.tar.gz --strip-components=1 -C sqlite3 && cd sqlite3 && ./configure CFLAGS=-fPIC && make && make install
RUN tar -xzvf protobuf-cpp-3.20.1.tar.gz && cd protobuf-3.20.1 && ./configure --enable-shared=no CFLAGS=-fPIC CXXFLAGS=-fPIC && make && make install
RUN cd protobuf-c && ./autogen.sh && ./configure --disable-protoc --enable-shared=no CFLAGS=-fPIC CXXFLAGS=-fPIC && make && make install
RUN cd neuron && mkdir build && cd build && cmake … && make
#runner
FROM base AS runner
RUN apt install -y curl
COPY --from=builder /usr/lib/x86_64-linux-gnu/libasan.so.8.0.0 /usr/lib/x86_64-linux-gnu/
COPY --from=builder /usr/lib/x86_64-linux-gnu/libasan.so.8 /usr/lib/x86_64-linux-gnu/
COPY --from=builder /usr/local/lib/ /usr/local/lib/
COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /opt/neuron/build/config /opt/neuron/config
COPY --from=builder /opt/neuron/build/libneuron-base.so /opt/neuron
COPY --from=builder /opt/neuron/build/logs /opt/neuron/logs
COPY --from=builder /opt/neuron/build/neuron /opt/neuron
COPY --from=builder /opt/neuron/build/persistence /opt/neuron/persistence
COPY --from=builder /opt/neuron/build/plugins /opt/neuron/plugins
COPY --from=builder /opt/neuron/build/simulator /opt/neuron/simulator
COPY --from=builder /opt/neuron/build/tests /opt/neuron/tests
WORKDIR /opt/neuron
COPY neuron-dashboard.zip .
#RUN curl -o neuron-dashboard.zip https://github.com/emqx/neuron-dashboard/releases/download/2.4.9/neuron-dashboard.zip
RUN unzip neuron-dashboard.zip
EXPOSE 7000
CMD [“./neuron”]
gcc版本:
错误内容: