Skip to content

Commit

Permalink
Use files with list of dependencies for building gsad
Browse files Browse the repository at this point in the history
Introduce files with lists of dependencies for building and running
gsad.
  • Loading branch information
bjoernricks committed Jan 23, 2025
1 parent 3628d9a commit f182776
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 28 deletions.
14 changes: 7 additions & 7 deletions .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ FROM registry.community.greenbone.net/community/gvm-libs:${GVM_LIBS_VERSION} AS
COPY . /source
WORKDIR /source

RUN sh /source/.github/install-build-dependencies.sh
RUN cmake -DCMAKE_BUILD_TYPE=Release -B /build /source
RUN DESTDIR=/install cmake --build /build -j$(nproc) -- install
RUN sh /source/.github/install-dependencies.sh \
/source/.github/build-dependencies.list \
&& rm -rf /var/lib/apt/lists/*
RUN cmake -DCMAKE_BUILD_TYPE=Release -B /build /source \
&& DESTDIR=/install cmake --build /build -j$(nproc) -- install

FROM registry.community.greenbone.net/community/gvm-libs:${GVM_LIBS_VERSION}

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
gosu \
libmicrohttpd12 \
RUN --mount=type=bind,source=.github,target=/source/ \
sh /source/install-dependencies.sh /source/runtime-dependencies.list \
&& rm -rf /var/lib/apt/lists/*

COPY --from=build /install/ /
Expand Down
11 changes: 11 additions & 0 deletions .github/build-dependencies.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build-essential
cmake
gcc
git
libgcrypt-dev
libglib2.0-dev
libgnutls28-dev
libmicrohttpd-dev
libssh-dev
libxml2-dev
pkg-config
18 changes: 0 additions & 18 deletions .github/install-build-dependencies.sh

This file was deleted.

16 changes: 16 additions & 0 deletions .github/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This script installs the dependencies of gsad
set -e

BASEDIR=$(dirname "$0")
DEFAULT_DEPENDENCIES_FILE="$BASEDIR/build-dependencies.list"
DEPENDENCIES_FILE=${1:-$DEFAULT_DEPENDENCIES_FILE}

if [[ ! -f "$DEPENDENCIES_FILE" ]]; then
echo "Dependencies file not found: $DEPENDENCIES_FILE"
exit 1
fi

apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
$(grep -v '#' "$DEPENDENCIES_FILE")
2 changes: 2 additions & 0 deletions .github/runtime-dependencies.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gosu
libmicrohttpd12
5 changes: 2 additions & 3 deletions .github/workflows/ci-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: sh .github/install-build-dependencies.sh
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Configure and compile gsad
run: |
rm -rf .git
Expand All @@ -46,10 +46,9 @@ jobs:
run: |
apt-get update
apt-get install --no-install-recommends -y ca-certificates git
rm -rf /var/lib/apt/lists/*
- uses: actions/checkout@v4
- name: Install build dependencies
run: sh .github/install-build-dependencies.sh
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Install cgreen
uses: greenbone/actions/install-cgreen@v3
- name: Configure and compile gsad
Expand Down

0 comments on commit f182776

Please sign in to comment.