diff options
author | Ryo Nakamura <upa@haeena.net> | 2024-02-04 11:35:20 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2024-02-04 11:35:20 +0900 |
commit | 25207cf865dfaefbb6c4a20949b78a239ee83c66 (patch) | |
tree | d3693658538bed4e339d71182e937b72deb404ec | |
parent | 306a00ced564829d0c265644b99ecaa0de32920b (diff) |
build deb sources inside a container
A new build target `build-deb` builds mscp deb inside a docker
container. All debuild -us -uc outputs are copied to build/debbuild
directory.
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | docker/build-deb.Dockerfile | 20 | ||||
-rwxr-xr-x | scripts/install-build-deps.sh | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bd6301d..66b0a11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,6 +264,20 @@ add_custom_target(docker-test-all DEPENDS ${DOCKER_TESTS}) add_custom_target(docker-pkg-all DEPENDS ${DOCKER_PKGS}) +### debuild-related fefinitions + +set(DEBBUILDCONTAINER mscp-build-deb) +add_custom_target(build-deb + COMMENT "build mscp deb files inside a container" + WORKING_DIRECTORY ${mscp_SOURCE_DIR} + BYPRODUCTS ${CMAKE_BINARY_DIR}/debbuild + COMMAND + docker build -t ${DEBBUILDCONTAINER} -f docker/build-deb.Dockerfile . + COMMAND + docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${DEBBUILDCONTAINER} + cp -r /debbuild /out/) + + ### rpmbuild-related definitions # generate files for rpmbuild @@ -289,3 +303,4 @@ add_custom_target(build-srpm docker run --rm -v ${CMAKE_BINARY_DIR}:/out ${RPMBUILDCONTAINER} cp /root/rpmbuild/SRPMS/${SRPMFILE} /out/) + diff --git a/docker/build-deb.Dockerfile b/docker/build-deb.Dockerfile new file mode 100644 index 0000000..e3e6381 --- /dev/null +++ b/docker/build-deb.Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:22.04 + +ARG DEBIAN_FRONTEND=noninteractive +RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates build-essential devscripts debhelper gcc make cmake + +ARG mscpdir="/debbuild/mscp" + +COPY . ${mscpdir} + +# install build dependency +RUN ${mscpdir}/scripts/install-build-deps.sh + +# build +RUN cd ${mscpdir} \ + && debuild -us -uc \ + && mv ${mscpdir} / + +# Then all debuild output files exsit at /debbuild + diff --git a/scripts/install-build-deps.sh b/scripts/install-build-deps.sh index 92ee42b..5c46a61 100755 --- a/scripts/install-build-deps.sh +++ b/scripts/install-build-deps.sh @@ -19,7 +19,7 @@ case $platform in brew install openssl@1.1 ;; Linux-ubuntu*) - apt-get install -y \ + apt-get install --no-install-recommends -y \ gcc make cmake zlib1g-dev libssl-dev libkrb5-dev ;; Linux-centos* | Linux-rhel* | Linux-rocky* | Linux-almalinux) |