diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..751deb0e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +build/ +.git/ +Dockerfile diff --git a/.gitignore b/.gitignore index 03314f77..edd6002b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ Cargo.lock + +# build script files +build +/build_* +cmake_build +.cmake_build + +# buck generated files +.buckd/ +.lsp-buck-out/ +.lsp.buckd/ +buck-out/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..1d308876 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:22.04 as build +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + git \ + libssl-dev \ + ninja-build \ + tini \ + && rm -rf /var/lib/apt/lists/* +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y +ENV PATH /root/.cargo/bin:$PATH + +WORKDIR /dyno-build +COPY . . +RUN scripts/build.sh + +FROM ubuntu:22.04 as final +WORKDIR / +COPY --from=build /dyno-build/build/dynolog/src/dynolog /dyno-build/build/release/dyno /opt/dyno/ +COPY --from=build /usr/bin/tini /tini +ENTRYPOINT ["/tini", "--"] +CMD ["/opt/dyno/dynolog", "--enable_ipc_monitor"] diff --git a/scripts/build.sh b/scripts/build.sh index b088e28c..cf7f4ce6 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -11,7 +11,7 @@ set -eux -o pipefail # Check dependencies cmake --version || echo "Please install cmake for your platform using dnf/apt-get etc." -ninja-build --version || echo "Please install ninja for your platform using dnf/apt-get etc." +ninja --version || echo "Please install ninja for your platform using dnf/apt-get etc." rustc --version || echo "Please install Rust and Cargo - see https://www.rust-lang.org/tools/install" cargo --version || echo "Please install Rust and Cargo - see https://www.rust-lang.org/tools/install" @@ -20,7 +20,7 @@ echo "Running cmake" mkdir -p build; cd build; # note we can build without ninja if not available on this system -cmake -DCMAKE_BUILD_TYPE=Release -G=Ninja "$@" .. +cmake -DCMAKE_BUILD_TYPE=Release -GNinja "$@" .. cmake --build . echo "Binary files ="