Skip to content

Commit

Permalink
Adds possibility to add cmake flags to a container build
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsfrei committed Apr 15, 2024
1 parent 58691f0 commit 7ff6cb5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ ARG VERSION=edge
ARG GVM_LIBS_VERSION=oldstable
ARG DEBIAN_FRONTEND=noninteractive
ARG IMAGE_REGISTRY=ghcr.io
# when set it will added to the cmake command
# As an example:
# FEATURE_TOGGLES="-DOPENVASD=1"
# enables openvasd feature toggle.
ARG FEATURE_TOGGLE=""

FROM ${IMAGE_REGISTRY}/greenbone/gvmd-build:${VERSION} as builder
ARG FEATURE_TOGGLE

COPY . /source
WORKDIR /source

RUN mkdir /build && \
mkdir /install && \
cd /build && \
cmake -DCMAKE_BUILD_TYPE=Release /source && \
cmake -DCMAKE_BUILD_TYPE=Release $FEATURE_TOGGLE /source && \
make DESTDIR=/install install

FROM greenbone/gvm-libs:${GVM_LIBS_VERSION}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
build:
- stable
- edge
- edge_openvasd
name: "Build Images"
runs-on: ubuntu-latest
steps:
Expand All @@ -32,6 +33,7 @@ jobs:
type=raw,value=latest,enable=${{ matrix.build == 'stable' }}
type=raw,value=stable,enable=${{ matrix.build == 'stable' }}
type=raw,value=edge,enable=${{ matrix.build == 'edge' }}
type=raw,value=edge-openvasd,enable=${{ matrix.build == 'edge_openvasd' }}
- name: Set container build options
id: container-opts
run: |
Expand All @@ -40,6 +42,11 @@ jobs:
else
echo "gvm-libs-version=oldstable-edge" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.build }}" = 'edge_openvasd' ]]; then
echo 'ft=-DOPENVASD=1' >> $GITHUB_OUTPUT
else
echo 'ft=-DOPENVASD=0' >> $GITHUB_OUTPUT
fi
- name: Login to GitHub Docker registry
uses: docker/login-action@v3
with:
Expand All @@ -58,6 +65,7 @@ jobs:
push: true
build-args: |
GVM_LIBS_VERSION=${{ steps.container-opts.outputs.gvm-libs-version }}
FEATURE_TOGGLE=${{ steps.container-opts.outputs.ft }}
file: .docker/build.Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
Expand Down

0 comments on commit 7ff6cb5

Please sign in to comment.