From b753ff45e55917b75876bd4e4a375d7f3ef30e49 Mon Sep 17 00:00:00 2001 From: Daniel Thamdrup Date: Thu, 11 Jul 2024 11:25:18 +0200 Subject: [PATCH] add dockerfile with static build and example compose file Signed-off-by: Daniel Thamdrup --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ docker-compose.yml | 0 2 files changed, 34 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..54830663 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# syntax=docker/dockerfile:latest +FROM scratch AS src +COPY . /src + +FROM alpine:latest AS build +RUN --mount=type=bind,readwrite,from=src,source=/src,target=/src \ + apk add \ + alpine-sdk \ + clang \ + cmake \ + libuv-dev \ + libuv-static \ + lld \ + openssl-dev \ + openssl-libs-static \ + samurai && \ + cmake \ + -S /src \ + -B /src/build \ + -G Ninja \ + -D BUILD_STATIC=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_C_COMPILER=clang \ + -D CMAKE_CXX_COMPILER=clang++ \ + -D CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -static -static-libgcc -static-libstdc++" \ + -D OPENSSL_USE_STATIC_LIBS=ON \ + -D WITH_HTTP=ON \ + -D WITH_TLS=ON && \ + cmake --build /src/build && \ + mv /src/build/xmrig-proxy /xmrig-proxy + +FROM scratch AS runtime +COPY --from=build /xmrig-proxy /xmrig-proxy +ENTRYPOINT [ "/xmrig-proxy" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..e69de29b