diff --git a/Dockerfile b/Dockerfile index 18dc3b5d..11d35b3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,31 @@ -# === BUILDER IMAGE === -FROM alpine:3.12 as builder +# === RUNTIME DEPENDENCIES IMAGE === +FROM alpine:3.12 as runtime-deps USER root WORKDIR /cvdi-stream -ENV DEBIAN_FRONTEND=noninteractive - # update the package manager RUN apk update +# add runtime dependencies +RUN apk add --upgrade --no-cache \ + bash \ + librdkafka \ + librdkafka-dev + +# === BUILDER IMAGE === +FROM runtime-deps as builder +USER root + +WORKDIR /cvdi-stream + +ENV DEBIAN_FRONTEND=noninteractive + # add build dependencies RUN apk add --upgrade --no-cache --virtual .build-deps \ cmake \ g++ \ - make \ - librdkafka \ - librdkafka-dev + make # add the source and build files ADD CMakeLists.txt /cvdi-stream @@ -30,17 +40,11 @@ ADD ./config /cvdi-stream/config RUN export LD_LIBRARY_PATH=/usr/local/lib && mkdir /cvdi-stream-build && cd /cvdi-stream-build && cmake /cvdi-stream && make # === RUNTIME IMAGE === -FROM alpine:3.12 +FROM runtime-deps USER root WORKDIR /cvdi-stream -# add runtime dependencies -RUN apk add --upgrade --no-cache \ - bash \ - librdkafka \ - librdkafka-dev - # copy the built files from the builder COPY --from=builder /cvdi-stream-build/ /cvdi-stream-build/ COPY --from=builder /cvdi-stream /cvdi-stream diff --git a/Dockerfile-nsv b/Dockerfile-nsv index 4d14caf8..28c3139e 100644 --- a/Dockerfile-nsv +++ b/Dockerfile-nsv @@ -1,5 +1,20 @@ +# === RUNTIME DEPENDENCIES IMAGE === +FROM alpine:3.12 as runtime-deps +USER root + +WORKDIR /cvdi-stream + +# update the package manager +RUN apk update + +# add runtime dependencies +RUN apk add --upgrade --no-cache \ + bash \ + librdkafka \ + librdkafka-dev + # === BUILDER IMAGE === -FROM alpine:3.12 as builder +FROM runtime-deps as builder USER root ARG PPM_CONFIG_FILE ARG PPM_MAP_FILE @@ -8,16 +23,11 @@ WORKDIR /cvdi-stream ENV DEBIAN_FRONTEND=noninteractive -# update the package manager -RUN apk update - # add build dependencies RUN apk add --upgrade --no-cache --virtual .build-deps \ cmake \ g++ \ - make \ - librdkafka \ - librdkafka-dev + make # add the source and build files ADD CMakeLists.txt /cvdi-stream @@ -34,17 +44,11 @@ ADD ./config /cvdi-stream/config RUN export LD_LIBRARY_PATH=/usr/local/lib && mkdir /cvdi-stream-build && cd /cvdi-stream-build && cmake /cvdi-stream && make # === RUNTIME IMAGE === -FROM alpine:3.12 +FROM runtime-deps USER root WORKDIR /cvdi-stream -# add runtime dependencies -RUN apk add --upgrade --no-cache \ - bash \ - librdkafka \ - librdkafka-dev - # copy the built files from the builder COPY --from=builder /cvdi-stream-build/ /cvdi-stream-build/ COPY --from=builder /cvdi-stream /cvdi-stream diff --git a/Dockerfile.standalone b/Dockerfile.standalone index fa6a70d4..bc786cd2 100644 --- a/Dockerfile.standalone +++ b/Dockerfile.standalone @@ -1,21 +1,31 @@ -# === BUILDER IMAGE === -FROM alpine:3.12 as builder +# === RUNTIME DEPENDENCIES IMAGE === +FROM alpine:3.12 as runtime-deps USER root WORKDIR /cvdi-stream -ENV DEBIAN_FRONTEND=noninteractive - # update the package manager RUN apk update +# add runtime dependencies +RUN apk add --upgrade --no-cache \ + bash \ + librdkafka \ + librdkafka-dev + +# === BUILDER IMAGE === +FROM runtime-deps as builder +USER root + +WORKDIR /cvdi-stream + +ENV DEBIAN_FRONTEND=noninteractive + # add build dependencies RUN apk add --upgrade --no-cache --virtual .build-deps \ cmake \ g++ \ - make \ - librdkafka \ - librdkafka-dev + make # add the source and build files ADD CMakeLists.txt /cvdi-stream @@ -30,17 +40,11 @@ ADD ./config /cvdi-stream/config RUN export LD_LIBRARY_PATH=/usr/local/lib && mkdir /cvdi-stream-build && cd /cvdi-stream-build && cmake /cvdi-stream && make # === RUNTIME IMAGE === -FROM alpine:3.12 +FROM runtime-deps USER root WORKDIR /cvdi-stream -# add runtime dependencies -RUN apk add --upgrade --no-cache \ - bash \ - librdkafka \ - librdkafka-dev - # copy the built files from the builder COPY --from=builder /cvdi-stream-build/ /cvdi-stream-build/ COPY --from=builder /cvdi-stream /cvdi-stream diff --git a/Dockerfile.testing b/Dockerfile.testing index 6a68b5fe..f24d3ada 100644 --- a/Dockerfile.testing +++ b/Dockerfile.testing @@ -1,21 +1,31 @@ -# === BUILDER IMAGE === -FROM alpine:3.12 as builder +# === RUNTIME DEPENDENCIES IMAGE === +FROM alpine:3.12 as runtime-deps USER root WORKDIR /cvdi-stream -ENV DEBIAN_FRONTEND=noninteractive - # update the package manager RUN apk update +# add runtime dependencies +RUN apk add --upgrade --no-cache \ + bash \ + librdkafka \ + librdkafka-dev + +# === BUILDER IMAGE === +FROM runtime-deps as builder +USER root + +WORKDIR /cvdi-stream + +ENV DEBIAN_FRONTEND=noninteractive + # add build dependencies RUN apk add --upgrade --no-cache --virtual .build-deps \ cmake \ g++ \ - make \ - librdkafka \ - librdkafka-dev + make # add the source and build files ADD CMakeLists.txt /cvdi-stream @@ -30,18 +40,11 @@ ADD ./config /cvdi-stream/config RUN export LD_LIBRARY_PATH=/usr/local/lib && mkdir /cvdi-stream-build && cd /cvdi-stream-build && cmake /cvdi-stream && make # === RUNTIME IMAGE === -FROM alpine:3.12 +FROM runtime-deps USER root WORKDIR /cvdi-stream -# add runtime dependencies -RUN apk add --upgrade --no-cache \ - bash \ - python3 \ - librdkafka \ - librdkafka-dev - # copy the built files from the builder COPY --from=builder /cvdi-stream-build/ /cvdi-stream-build/ COPY --from=builder /cvdi-stream /cvdi-stream