aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-04-07 01:47:23 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-04-07 02:11:19 +0300
commit5a5f482d865e5ead486c67d915035011014a5069 (patch)
tree1cf20381b6775d7a7c3578663981eee6baf18106
parentMakefile: allow to override MATH_SERVER_TESTS (diff)
downloadmath-server-5a5f482d865e5ead486c67d915035011014a5069.tar.gz
math-server-5a5f482d865e5ead486c67d915035011014a5069.zip
Dockerfile: best practices
-rw-r--r--client/Dockerfile7
-rw-r--r--server/Dockerfile7
2 files changed, 10 insertions, 4 deletions
diff --git a/client/Dockerfile b/client/Dockerfile
index 8da5148..e10dab9 100644
--- a/client/Dockerfile
+++ b/client/Dockerfile
@@ -3,9 +3,11 @@
FROM alpine:3.11 AS base
+ARG src_dir=/usr/src/math-server
+
FROM base AS builder
-ENV src_dir=/usr/src/math-server
+ARG src_dir
COPY [".", "$src_dir"]
RUN build_deps='bash boost-dev cmake g++ make python3' && \
@@ -17,7 +19,8 @@ FROM base
LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>"
-COPY --from=builder ["/usr/src/math-server/.build/install", "/opt/math-server"]
+ARG src_dir
+COPY --from=builder ["$src_dir/.build/install", "/opt/math-server"]
RUN runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \
apk add $runtime_deps && \
diff --git a/server/Dockerfile b/server/Dockerfile
index acb02e2..0ac89ee 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -3,9 +3,11 @@
FROM alpine:3.11 AS base
+ARG src_dir=/usr/src/math-server
+
FROM base AS builder
-ENV src_dir=/usr/src/math-server
+ARG src_dir
COPY [".", "$src_dir"]
RUN build_deps='bash boost-dev cmake g++ make python3' && \
@@ -17,7 +19,8 @@ FROM base
LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>"
-COPY --from=builder ["/usr/src/math-server/.build/install", "/opt/math-server"]
+ARG src_dir
+COPY --from=builder ["$src_dir/.build/install", "/opt/math-server"]
RUN runtime_deps='boost-filesystem boost-program_options boost-regex boost-unit_test_framework libstdc++' && \
apk add $runtime_deps && \