diff options
-rw-r--r-- | client/Dockerfile | 23 | ||||
-rw-r--r-- | server/Dockerfile | 23 |
2 files changed, 28 insertions, 18 deletions
diff --git a/client/Dockerfile b/client/Dockerfile index 349e240..640391b 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,9 +1,9 @@ # To build, run from the top-level directory: # docker build -f client/Dockerfile -t egortensin/math-client . -FROM alpine:3.11 +FROM alpine:3.11 AS base -LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>" +FROM base AS builder ENV src_dir=/usr/src/math-server COPY [".", "$src_dir"] @@ -11,17 +11,22 @@ COPY [".", "$src_dir"] RUN build_deps='boost-dev cmake g++ make python3' && \ apk add --no-cache $build_deps && \ "$src_dir/cmake/cmake/build/build.py" \ - --install /usr/local \ + --install /opt/math-server \ --configuration Release \ -- \ "$src_dir" \ -D ENABLE_TESTS=ON \ - -D Boost_USE_STATIC_LIBS=OFF && \ - rm -rf -- "$src_dir" && \ - apk del --purge --rdepends $build_deps && \ - runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \ + -D Boost_USE_STATIC_LIBS=OFF + +FROM base + +LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>" + +COPY --from=builder ["/opt/math-server", "/opt/math-server"] + +RUN runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \ apk add $runtime_deps && \ - /usr/local/bin/math-server-unit-tests --log_level=all + /opt/math-server/bin/math-server-unit-tests --log_level=all -ENTRYPOINT ["/usr/local/bin/math-client"] +ENTRYPOINT ["/opt/math-server/bin/math-client"] CMD ["-c", "2 * 2"] diff --git a/server/Dockerfile b/server/Dockerfile index 609c1ff..22364e8 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,9 +1,9 @@ # To build, run from the top-level directory: # docker build -f server/Dockerfile -t egortensin/math-server . -FROM alpine:3.11 +FROM alpine:3.11 AS base -LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>" +FROM base AS builder ENV src_dir=/usr/src/math-server COPY [".", "$src_dir"] @@ -11,16 +11,21 @@ COPY [".", "$src_dir"] RUN build_deps='boost-dev cmake g++ make python3' && \ apk add --no-cache $build_deps && \ "$src_dir/cmake/cmake/build/build.py" \ - --install /usr/local \ + --install /opt/math-server \ --configuration Release \ -- \ "$src_dir" \ -D ENABLE_TESTS=ON \ - -D Boost_USE_STATIC_LIBS=OFF && \ - rm -rf -- "$src_dir" && \ - apk del --purge --rdepends $build_deps && \ - runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \ + -D Boost_USE_STATIC_LIBS=OFF + +FROM base + +LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>" + +COPY --from=builder ["/opt/math-server", "/opt/math-server"] + +RUN runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \ apk add $runtime_deps && \ - /usr/local/bin/math-server-unit-tests --log_level=all + /opt/math-server/bin/math-server-unit-tests --log_level=all -CMD ["/usr/local/bin/math-server"] +CMD ["/opt/math-server/bin/math-server"] |