Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit fff10b2

Browse files
committed
feat: add ruby and some gems to installation
Signed-off-by: Robert Waffen <rwaffen@gmail.com>
1 parent a69b563 commit fff10b2

File tree

3 files changed

+64
-51
lines changed

3 files changed

+64
-51
lines changed

puppetserver/Dockerfile.alpine

Lines changed: 62 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
FROM alpine:3.20 AS build
1+
FROM alpine:3.20 AS base
2+
3+
# Install JDK
4+
RUN apk update && apk upgrade \
5+
&& apk add openjdk17-jre-headless \
6+
&& apk add --no-cache --update bash \
7+
&& rm -rf /var/cache/apk/*
8+
9+
################################################################################
10+
11+
FROM base AS build
212

313
ARG VERSION=8.6.3
414
ADD https://downloads.puppet.com/puppet/puppetserver-${VERSION}.tar.gz /
@@ -13,44 +23,41 @@ ENV bindir=/opt/puppetlabs/server/apps/puppetserver/bin
1323
ENV symbindir=/opt/puppetlabs/server/bin
1424
ENV uxbindir=/opt/puppetlabs/bin
1525

16-
RUN apk update && apk upgrade \
17-
&& apk add --no-cache --update openjdk17-jre-headless \
18-
&& apk add --no-cache --update bash \
19-
&& cd /install \
26+
RUN apk update && cd /install \
2027
&& install -d -m 0755 "${apps_dir}/puppetserver" \
2128
&& install -d -m 0770 "${data_dir}/puppetserver" \
22-
&& install -m 0644 /install/puppet-server-release.jar "${apps_dir}/puppetserver" \
23-
&& install -m 0774 /install/ext/ezbake-functions.sh "${apps_dir}/puppetserver" \
24-
&& install -m 0644 /install/ext/ezbake.manifest "${apps_dir}/puppetserver" \
29+
&& install -m 0644 puppet-server-release.jar "${apps_dir}/puppetserver" \
30+
&& install -m 0774 ext/ezbake-functions.sh "${apps_dir}/puppetserver" \
31+
&& install -m 0644 ext/ezbake.manifest "${apps_dir}/puppetserver" \
2532
&& install -d -m 0755 "${etc_dir}/puppetserver/conf.d" \
2633
&& install -d -m 0755 "${etc_dir}/puppetserver/services.d" \
27-
&& install -m 0644 /install/ext/config/request-logging.xml "${etc_dir}/puppetserver/request-logging.xml" \
28-
&& install -m 0644 /install/ext/config/conf.d/puppetserver.conf "${etc_dir}/puppetserver/conf.d/puppetserver.conf" \
29-
&& install -m 0644 /install/ext/config/logback.xml "${etc_dir}/puppetserver/logback.xml" \
30-
&& install -m 0644 /install/ext/config/services.d/ca.cfg "${etc_dir}/puppetserver/services.d/ca.cfg" \
31-
&& install -m 0644 /install/ext/config/conf.d/global.conf "${etc_dir}/puppetserver/conf.d/global.conf" \
32-
&& install -m 0644 /install/ext/config/conf.d/web-routes.conf "${etc_dir}/puppetserver/conf.d/web-routes.conf" \
33-
&& install -m 0644 /install/ext/config/conf.d/auth.conf "${etc_dir}/puppetserver/conf.d/auth.conf" \
34-
&& install -m 0644 /install/ext/config/conf.d/metrics.conf "${etc_dir}/puppetserver/conf.d/metrics.conf" \
35-
&& install -m 0644 /install/ext/config/conf.d/ca.conf "${etc_dir}/puppetserver/conf.d/ca.conf" \
36-
&& install -m 0644 /install/ext/config/conf.d/webserver.conf "${etc_dir}/puppetserver/conf.d/webserver.conf" \
34+
&& install -m 0644 ext/config/request-logging.xml "${etc_dir}/puppetserver/request-logging.xml" \
35+
&& install -m 0644 ext/config/conf.d/puppetserver.conf "${etc_dir}/puppetserver/conf.d/puppetserver.conf" \
36+
&& install -m 0644 ext/config/logback.xml "${etc_dir}/puppetserver/logback.xml" \
37+
&& install -m 0644 ext/config/services.d/ca.cfg "${etc_dir}/puppetserver/services.d/ca.cfg" \
38+
&& install -m 0644 ext/config/conf.d/global.conf "${etc_dir}/puppetserver/conf.d/global.conf" \
39+
&& install -m 0644 ext/config/conf.d/web-routes.conf "${etc_dir}/puppetserver/conf.d/web-routes.conf" \
40+
&& install -m 0644 ext/config/conf.d/auth.conf "${etc_dir}/puppetserver/conf.d/auth.conf" \
41+
&& install -m 0644 ext/config/conf.d/metrics.conf "${etc_dir}/puppetserver/conf.d/metrics.conf" \
42+
&& install -m 0644 ext/config/conf.d/ca.conf "${etc_dir}/puppetserver/conf.d/ca.conf" \
43+
&& install -m 0644 ext/config/conf.d/webserver.conf "${etc_dir}/puppetserver/conf.d/webserver.conf" \
3744
&& install -d -m 0755 "${apps_dir}/puppetserver/cli" \
3845
&& install -d -m 0755 "${apps_dir}/puppetserver/cli/apps" \
3946
&& install -d -m 0755 "${bindir}" \
4047
&& install -d -m 0755 "${symbindir}" \
4148
&& install -d -m 0755 "${uxbindir}" \
42-
&& install -m 0755 "/install/ext/bin/puppetserver" "${bindir}/puppetserver" \
49+
&& install -m 0755 "ext/bin/puppetserver" "${bindir}/puppetserver" \
4350
&& ln -s "../apps/puppetserver/bin/puppetserver" "${symbindir}/puppetserver" \
4451
&& ln -s "../server/apps/puppetserver/bin/puppetserver" "${uxbindir}/puppetserver" \
45-
&& install -m 0755 /install/ext/cli/foreground "${apps_dir}/puppetserver/cli/apps/foreground" \
46-
&& install -m 0755 /install/ext/cli/dropsonde "${apps_dir}/puppetserver/cli/apps/dropsonde" \
47-
&& install -m 0755 /install/ext/cli/ca "${apps_dir}/puppetserver/cli/apps/ca" \
48-
&& install -m 0755 /install/ext/cli/irb "${apps_dir}/puppetserver/cli/apps/irb" \
49-
&& install -m 0755 /install/ext/cli/gem "${apps_dir}/puppetserver/cli/apps/gem" \
50-
&& install -m 0755 /install/ext/cli/reload "${apps_dir}/puppetserver/cli/apps/reload" \
51-
&& install -m 0755 /install/ext/cli/ruby "${apps_dir}/puppetserver/cli/apps/ruby" \
52-
&& install -m 0755 /install/ext/cli/stop "${apps_dir}/puppetserver/cli/apps/stop" \
53-
&& install -m 0755 /install/ext/cli/start "${apps_dir}/puppetserver/cli/apps/start" \
52+
&& install -m 0755 ext/cli/foreground "${apps_dir}/puppetserver/cli/apps/foreground" \
53+
&& install -m 0755 ext/cli/dropsonde "${apps_dir}/puppetserver/cli/apps/dropsonde" \
54+
&& install -m 0755 ext/cli/ca "${apps_dir}/puppetserver/cli/apps/ca" \
55+
&& install -m 0755 ext/cli/irb "${apps_dir}/puppetserver/cli/apps/irb" \
56+
&& install -m 0755 ext/cli/gem "${apps_dir}/puppetserver/cli/apps/gem" \
57+
&& install -m 0755 ext/cli/reload "${apps_dir}/puppetserver/cli/apps/reload" \
58+
&& install -m 0755 ext/cli/ruby "${apps_dir}/puppetserver/cli/apps/ruby" \
59+
&& install -m 0755 ext/cli/stop "${apps_dir}/puppetserver/cli/apps/stop" \
60+
&& install -m 0755 ext/cli/start "${apps_dir}/puppetserver/cli/apps/start" \
5461
&& install -d -m 0700 "${app_logdir}/puppetserver" \
5562
&& install -d -m 0755 "${run_dir}/puppetserver" \
5663
&& install -d -m 700 "${data_dir}/puppetserver/jars" \
@@ -59,11 +66,11 @@ RUN apk update && apk upgrade \
5966
&& install -d -m=775 /opt/puppetlabs/server/data \
6067
&& install -d "${etc_dir}/puppet/ssl" \
6168
&& install -d "${etc_dir}/puppetserver/ca" \
62-
&& bash /install/ext/build-scripts/install-vendored-gems.sh
69+
&& bash ext/build-scripts/install-vendored-gems.sh
6370

6471
################################################################################
6572

66-
FROM alpine:3.20 AS final
73+
FROM base AS final
6774

6875
ARG vcs_ref
6976
ARG build_date
@@ -80,12 +87,11 @@ LABEL \
8087
org.label-schema.vendor="Voxpupuli"
8188

8289
ENV PUPPETSERVER_JAVA_ARGS="-Xms1024m -Xmx1024m" \
83-
JAVA_ARGS=${PUPPETSERVER_JAVA_ARGS} \
8490
PATH=$PATH:/opt/puppetlabs/server/bin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/bin \
8591
SSLDIR=/etc/puppetlabs/puppet/ssl \
8692
LOGDIR=/var/log/puppetlabs/puppetserver \
87-
PUPPETSERVER_HOSTNAME="" \
88-
CERTNAME="" \
93+
PUPPETSERVER_HOSTNAME="puppet" \
94+
CERTNAME="puppet" \
8995
DNS_ALT_NAMES="" \
9096
PUPPETSERVER_PORT=8140 \
9197
AUTOSIGN=true \
@@ -122,17 +128,6 @@ ENV apps_dir=/opt/puppetlabs/server/apps \
122128
symbindir=/opt/puppetlabs/server/bin \
123129
uxbindir=/opt/puppetlabs/bin
124130

125-
# old /etc/default/puppetserver
126-
# how where do i put this in the new world? 🤔
127-
#
128-
# ENV \
129-
# USER="puppet" \
130-
# GROUP="puppet" \
131-
# INSTALL_DIR="/opt/puppetlabs/server/apps/puppetserver" \
132-
# CONFIG="/etc/puppetlabs/puppetserver/conf.d" \
133-
# BOOTSTRAP_CONFIG="/etc/puppetlabs/puppetserver/services.d/,/opt/puppetlabs/server/apps/puppetserver/config/services.d/" \
134-
# SERVICE_STOP_RETRIES=60
135-
136131
COPY --from=build /opt/puppetlabs /opt/puppetlabs
137132
COPY --from=build /etc/puppetlabs /etc/puppetlabs
138133
COPY --from=build /var/log/puppetlabs /var/log/puppetlabs
@@ -149,13 +144,23 @@ COPY conf.d/puppetserver.conf /etc/puppetlabs/puppetserver/conf.d/
149144
COPY conf.d/product.conf /etc/puppetlabs/puppetserver/conf.d/
150145
COPY puppetdb.conf /var/tmp/puppet/
151146
COPY Dockerfile /
147+
COPY puppetserver /etc/default/puppetserver
152148

153-
RUN apk update && apk upgrade \
154-
&& apk add --no-cache --update openjdk17-jre-headless \
155-
&& apk add --no-cache --update bash \
149+
RUN apk update \
156150
&& apk add --no-cache --update dumb-init \
157151
&& apk add --no-cache --update openssh-client \
158152
&& apk add --no-cache --update libssh2 \
153+
&& apk add --no-cache --update ruby=3.3.3-r1 \
154+
&& apk add --no-cache --update ruby-dev=3.3.3-r1 \
155+
&& apk add --no-cache --update alpine-sdk=1.0-r1 \
156+
&& apk add --no-cache --update openssl=3.3.2-r0 \
157+
&& gem install --no-doc puppet -v 8.9.0 \
158+
&& gem install --no-doc hocon -v 1.4.0 \
159+
&& gem install --no-doc racc -v 1.8.1 \
160+
&& gem install --no-doc r10k -v 4.1.0 \
161+
&& gem install --no-doc hiera-eyaml -v 4.1.0 \
162+
&& gem install --no-doc puppetserver-ca -v 2.6.0 \
163+
&& apk del --no-cache --purge alpine-sdk \
159164
&& addgroup -g 1001 puppet \
160165
&& adduser -G puppet -u 1001 -h ${data_dir}/puppetserver -H -D -s /sbin/nologin puppet \
161166
&& chown -R puppet:puppet ${etc_dir}/puppet/ssl \
@@ -170,9 +175,17 @@ RUN apk update && apk upgrade \
170175
&& chmod 700 ${data_dir}/puppetserver/yaml \
171176
&& find /etc/puppetlabs/puppet/ssl -type d -print0 | xargs -0 chmod 770 \
172177
&& echo 'alias ll="ls -la --color=auto"' >> ~/.bashrc \
173-
&& chmod +x /docker-entrypoint.sh /healthcheck.sh /docker-entrypoint.d/*.sh
178+
&& chmod +x /docker-entrypoint.sh /healthcheck.sh /docker-entrypoint.d/*.sh \
179+
&& mkdir -p /opt/puppetlabs/puppet/bin \
180+
&& ln -s /usr/bin/puppet /opt/puppetlabs/puppet/bin/puppet \
181+
&& ln -s /usr/bin/facter /opt/puppetlabs/puppet/bin/facter \
182+
&& ln -s /usr/bin/ruby /opt/puppetlabs/puppet/bin/ruby \
183+
&& ln -s /usr/bin/gem /opt/puppetlabs/puppet/bin/gem \
184+
&& ln -s /usr/bin/irb /opt/puppetlabs/puppet/bin/irb \
185+
&& ln -s /usr/bin/erb /opt/puppetlabs/puppet/bin/erb \
186+
&& ln -s /usr/bin/r10k /opt/puppetlabs/puppet/bin/r10k \
187+
&& ln -s /usr/bin/hiera-eyaml /opt/puppetlabs/puppet/bin/hiera-eyaml
174188

175-
# gem install --no-doc r10k -v $R10K_VERSION && \
176189
# gem install --no-doc rugged -v $RUGGED_VERSION -- --with-ssh && \
177190

178191
# k8s uses livenessProbe, startupProbe, readinessProbe and ignores HEALTHCHECK

puppetserver/docker-entrypoint.d/55-set-masterport.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
hocon() {
6-
/opt/puppetlabs/puppet/lib/ruby/vendor_gems/bin/hocon "$@"
6+
/usr/bin/hocon "$@"
77
}
88

99
if test -n "$PUPPETSERVER_PORT"; then

puppetserver/docker-entrypoint.d/90-ca.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ca_running() {
88
}
99

1010
hocon() {
11-
/opt/puppetlabs/puppet/lib/ruby/vendor_gems/bin/hocon "$@"
11+
/usr/bin/hocon "$@"
1212
}
1313

1414
if [[ "$CA_ENABLED" != "true" ]]; then

0 commit comments

Comments
 (0)