FROM debian:bullseye AS builder

RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    pkg-config \
    bash \
    gcc-aarch64-linux-gnu \
    g++-aarch64-linux-gnu \
    binutils-aarch64-linux-gnu \
    qemu-user-static

WORKDIR /app

COPY . .

COPY --chmod=755 docker/_create_dropshell.sh /scripts/

RUN rm -rf build

ENV CXXFLAGS="-static-libstdc++ -static-libgcc"
ENV LDFLAGS="-static -pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive"

CMD ["/bin/bash","/scripts/_create_dropshell.sh"]