From fb38a85d8656e39e26c4a6db3fadd7706b099c35 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Fri, 9 Aug 2024 17:25:03 +0200 Subject: [PATCH] build from tar Signed-off-by: Robert Waffen --- build/Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ build/build.sh | 15 +++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 build/Dockerfile create mode 100755 build/build.sh diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 00000000..d0912682 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,40 @@ +FROM openjdk:24-bullseye + +ENV opt_dir=/opt/puppetlabs/server/apps/puppetserver +ENV etc_dir=/etc/puppetlabs/puppetserver + +WORKDIR $opt_dir + +COPY puppet-server-release.jar $opt_dir/puppet-server-release.jar + +COPY ext/cli $opt_dir/cli/apps +COPY ext/cli_defaults/cli-defaults.sh $opt_dir/cli/cli-defaults.sh +COPY ext/bin $opt_dir/bin +COPY ext/bin/puppetserver /opt/puppetlabs/bin/puppetserver +COPY ext/ezbake-functions.sh $opt_dir/ezbake-functions.sh +COPY install.sh $opt_dir/scripts/install.sh + +COPY ext/ezbake.manifest $opt_dir/ezbake.manifest +COPY ext/system-config/services.d/bootstrap.cfg $opt_dir/config/services.d/bootstrap.cfg +COPY ext/config/conf.d $etc_dir/conf.d +COPY ext/config/services.d $etc_dir/services.d +COPY ext/default /etc/default/puppetserver + +COPY ext/config/logback.xml \ + ext/config/request-logging.xml \ + ${etc_dir} + +RUN useradd --uid 1001 --home-dir ${opt_dir} --shell /usr/sbin/nologin --user-group puppet \ +&& chown -R puppet:puppet /opt/puppetlabs \ +&& chown -R puppet:puppet /etc/puppetlabs \ +&& chmod +x /opt/puppetlabs/bin/* \ +&& chmod +x ${opt_dir}/bin/* \ +&& chmod +x ${opt_dir}/cli/**/* \ +&& chmod +x ${opt_dir}/scripts/* \ +&& chmod +x ${opt_dir}/ezbake-functions.sh \ +&& ln -s /usr/local/openjdk-24/bin/java /usr/bin/java + +EXPOSE 8140 + +ENTRYPOINT ["/opt/puppetlabs/bin/puppetserver"] +CMD ["start"] diff --git a/build/build.sh b/build/build.sh new file mode 100755 index 00000000..70836ddf --- /dev/null +++ b/build/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +software_version=${1:-8.6.2} +container_version=${2:-1.0.0} + +curl -v https://downloads.puppet.com/puppet/puppetserver-${software_version}.tar.gz -o puppetserver-${software_version}.tar.gz +tar -xvf puppetserver-${software_version}.tar.gz + +cp Dockerfile puppetserver-${software_version}/ +cd puppetserver-${software_version} +docker build -t puppetserver:${software_version}-v${container_version} . + +cd - +rm -rf puppetserver-${software_version} +rm puppetserver-${software_version}.tar.gz