Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed docker CI actions & reduced installation duplication in dockerfiles #42

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
cmake --build _cmake_build --target install
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v2 # This Action Installs sonar cloud and build wrapper to run sonar scan analysis
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
- name: Build and Generate test coverage
run: |
cd $GITHUB_WORKSPACE
Expand Down
32 changes: 18 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
32 changes: 18 additions & 14 deletions Dockerfile-nsv
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
32 changes: 18 additions & 14 deletions Dockerfile.standalone
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
34 changes: 19 additions & 15 deletions Dockerfile.testing
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
# === 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 \
python3 \
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
Expand All @@ -30,18 +41,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
Expand Down
Loading