[BUILD] Add Dockerfiles and related small fixes.

This commit is contained in:
s3rj1k
2025-03-29 13:36:32 +01:00
parent a189aaa80c
commit 04dc456545
6 changed files with 369 additions and 8 deletions

View File

@@ -21,6 +21,8 @@ Configuring the repo is enough. Dependencies will be installed during the FreeSW
Just follow this [Dependency Building Guide](dependencies/README.md) without the need to set up the FreeSWITCH Debian repo.</br>
Although we recommend using the FreeSWITCH Debian repo as all the dependencies are already prebuilt for you.
> Note: There is a possibility to use pre-created [Dockerfile(s)](/docker/build) for building images, see comments inside each Dockerfile.
---
## Prerequisites
FreeSWITCH packages can be built when FreeSWITCH is cloned using `git` only.

View File

@@ -416,7 +416,7 @@ function build_all_libraries()
esac
done
if [ "$SETUP_LOCAL_REPO" == "true" ] && [ "$NEEDS_LOCAL_REPO" == "false" ]; then
if [ "$SETUP_LOCAL_REPO" == "true" ] || [ "$NEEDS_LOCAL_REPO" == "false" ]; then
setup_local_repository
echo "Local Debian repository has been set up at $OUTPUT_DIR."
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# lint: shfmt -w -s -bn -ci -sr -fn scripts/packaging/build/build-debs-native.sh
# lint: shfmt -w -s -bn -ci -sr -fn scripts/packaging/build/fsdeb.sh
set -e # Exit immediately if a command exits with a non-zero status
set -u # Treat unset variables as an error
@@ -12,7 +12,9 @@ print_usage()
exit 1
}
WORKING_DIR=$(git rev-parse --show-toplevel 2> /dev/null || pwd -P)
BUILD_NUMBER=""
OUTPUT_DIR=""
WORKING_DIR=""
while getopts ":b:o:w:" opt; do
case ${opt} in
@@ -27,12 +29,14 @@ if [ -z "${BUILD_NUMBER:-}" ] || [ -z "${OUTPUT_DIR:-}" ]; then
print_usage
fi
if [ -z "${WORKING_DIR}" ]; then
WORKING_DIR=$(git rev-parse --show-toplevel 2> /dev/null || pwd -P)
fi
if [ "$(id -u)" != "0" ]; then
echo "Non-root user detected. Execution may fail."
fi
cd "${WORKING_DIR}" || exit 1
install_deps()
{
apt-get update || echo "WARNING: apt-get update failed"
@@ -64,13 +68,13 @@ export_vars()
setup_git_local()
{
git config --global --add safe.directory "${WORKING_DIR}"
if [ -z "$(git config user.email)" ]; then
git config user.email "$(id -un)@localhost"
fi
if [ -z "$(git config user.name)" ]; then
git config user.name "$(id -un)"
fi
git config --add safe.directory '*'
}
bootstrap_freeswitch()
@@ -83,7 +87,7 @@ install_freeswitch_deps()
{
apt-get update || echo "WARNING: apt-get update failed"
mk-build-deps --install --remove debian/control \
--tool "apt-get --yes --no-install-recommends" || echo "WARNING: mk-build-deps failed"
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" || echo "WARNING: mk-build-deps failed"
apt-get --yes --fix-broken install || echo "WARNING: apt-get fix-broken failed"
}
@@ -105,9 +109,11 @@ build_and_move()
main()
{
cd "${WORKING_DIR}" || exit 1
install_deps
export_vars
setup_git_local
export_vars
bootstrap_freeswitch
install_freeswitch_deps
build_source_package