From 21c137302332f969eae34b407ad298b03ff16497 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 30 Nov 2019 03:58:18 +0300 Subject: add Docker files --- client/Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 18 ++++++++++++++++++ server/Dockerfile | 29 +++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 client/Dockerfile create mode 100644 docker-compose.yml create mode 100644 server/Dockerfile diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..b60e96b --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,30 @@ +# To build, run from the top-level directory: +# docker build -f client/Dockerfile -t egortensin/math-client . + +FROM debian + +LABEL maintainer="Egor Tensin " + +# Don't prompt: +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -yq && apt-get dist-upgrade -yq + +RUN apt-get install -yq build-essential cmake libboost-filesystem-dev libboost-program-options-dev libboost-test-dev + +COPY [".", "/tmp/src/"] + +WORKDIR /tmp/build + +RUN cmake -G "Unix Makefiles" \ + -D CMAKE_BUILD_TYPE=RelWithDebInfo \ + -D ENABLE_TESTS=ON \ + -D USE_STATIC_RUNTIME=OFF \ + -D CMAKE_CXX_STANDARD_LIBRARIES="-lpthread" \ + /tmp/src && \ + cmake --build test && \ + ./test/unit_tests/unit_tests --log_level=all && \ + cmake --build client + +ENTRYPOINT ["./client/client"] +CMD ["-c", "2 * 2"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..94754dd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' +services: + server: + build: + context: . + dockerfile: server/Dockerfile + expose: + - 18000 + image: egortensin/math-server + ports: + - 18000:18000 + restart: always + client: + build: + context: . + dockerfile: client/Dockerfile + entrypoint: ["/tmp/build/client/client", "-H", "server"] + image: egortensin/math-client diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..8b53b9e --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,29 @@ +# To build, run from the top-level directory: +# docker build -f server/Dockerfile -t egortensin/math-server . + +FROM debian + +LABEL maintainer="Egor Tensin " + +# Don't prompt: +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -yq && apt-get dist-upgrade -yq + +RUN apt-get install -yq build-essential cmake libboost-filesystem-dev libboost-program-options-dev libboost-test-dev + +COPY [".", "/tmp/src/"] + +WORKDIR /tmp/build + +RUN cmake -G "Unix Makefiles" \ + -D CMAKE_BUILD_TYPE=Release \ + -D ENABLE_TESTS=ON \ + -D USE_STATIC_RUNTIME=OFF \ + -D CMAKE_CXX_STANDARD_LIBRARIES="-lpthread" \ + /tmp/src && \ + cmake --build test && \ + ./test/unit_tests/unit_tests --log_level=all && \ + cmake --build server + +CMD ["./server/server"] -- cgit v1.2.3