Skip to content

Commit 116bddf

Browse files
committed
feat: add alpine image build
1 parent 6703d4c commit 116bddf

3 files changed

Lines changed: 301 additions & 1 deletion

File tree

.github/workflows/build_container.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ jobs:
4848
tags: |
4949
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64
5050
51+
- name: Build Alpine OpenVox Server ${{ matrix.release }} container
52+
if: ${{ matrix.release == '8' }}
53+
uses: voxpupuli/gha-build-and-publish-a-container@v2
54+
with:
55+
registry_password: ${{ secrets.GITHUB_TOKEN }}
56+
build_args: |
57+
OPENVOX_RELEASE=${{ matrix.release }}
58+
OPENVOXSERVER_VERSION=${{ matrix.server_version }}
59+
OPENVOXDB_VERSION=${{ matrix.db_version }}
60+
R10K_VERSION=${{ matrix.r10k_version }}
61+
build_arch: linux/amd64
62+
build_context: openvoxserver
63+
buildfile: openvoxserver/Containerfile.alpine
64+
tags: |
65+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
66+
5167
build-ARM-container:
5268
runs-on: ubuntu-24.04-arm
5369
permissions:
@@ -73,6 +89,22 @@ jobs:
7389
tags: |
7490
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64
7591
92+
- name: Build Alpine OpenVox Server ${{ matrix.release }} container
93+
if: ${{ matrix.release == '8' }}
94+
uses: voxpupuli/gha-build-and-publish-a-container@v2
95+
with:
96+
registry_password: ${{ secrets.GITHUB_TOKEN }}
97+
build_args: |
98+
OPENVOX_RELEASE=${{ matrix.release }}
99+
OPENVOXSERVER_VERSION=${{ matrix.server_version }}
100+
OPENVOXDB_VERSION=${{ matrix.db_version }}
101+
R10K_VERSION=${{ matrix.r10k_version }}
102+
build_arch: linux/arm64
103+
build_context: openvoxserver
104+
buildfile: openvoxserver/Containerfile.alpine
105+
tags: |
106+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine
107+
76108
create-multi-arch-manifests:
77109
runs-on: ubuntu-latest
78110
permissions:
@@ -123,3 +155,25 @@ jobs:
123155
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:latest \
124156
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-arm64 \
125157
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-x86_64
158+
159+
- name: Create Alpine multi arch manifests
160+
run: |
161+
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ steps.extract_version.outputs.version }}-${{ github.ref_name }}-alpine-beta \
162+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
163+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
164+
165+
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ steps.extract_version.outputs.version }}-latest-alpine-beta \
166+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
167+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
168+
169+
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-latest-alpine-beta \
170+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
171+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
172+
173+
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-alpine-beta \
174+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-arm64-alpine \
175+
ghcr.io/openvoxproject/openvoxserver:${{ matrix.release }}-${{ github.sha }}-x86_64-alpine
176+
177+
docker buildx imagetools create -t ghcr.io/openvoxproject/openvoxserver:latest-alpine-beta \
178+
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-arm64-alpine \
179+
ghcr.io/openvoxproject/openvoxserver:8-${{ github.sha }}-x86_64-alpine

.github/workflows/ci.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
const version = agentVersion.split('-')[0];
5454
core.setOutput('version', version);
5555
56-
- name: Build image
56+
- name: Build Ubuntu image
5757
uses: docker/build-push-action@v6
5858
with:
5959
tags: 'ci/openvoxserver:${{ steps.extract_version.outputs.version }}'
@@ -67,6 +67,20 @@ jobs:
6767
R10K_VERSION=${{ matrix.r10k_version }}
6868
RUGGED_VERSION=${{ matrix.rugged_version }}
6969
70+
- name: Build Alpine image
71+
if: ${{ matrix.release == '8' }}
72+
uses: docker/build-push-action@v6
73+
with:
74+
tags: 'ci/openvoxserver:${{ steps.extract_version.outputs.version }}-alpine'
75+
context: openvoxserver
76+
file: openvoxserver/Containerfile.alpine
77+
push: false
78+
build-args: |
79+
OPENVOX_RELEASE=${{ matrix.release }}
80+
OPENVOXSERVER_VERSION=${{ matrix.server_version }}
81+
OPENVOXDB_VERSION=${{ matrix.db_version }}
82+
R10K_VERSION=${{ matrix.r10k_version }}
83+
7084
tests:
7185
needs:
7286
- general_ci

openvoxserver/Containerfile.alpine

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
FROM alpine:3.21 AS base
2+
3+
# Install JDK
4+
RUN apk update && apk upgrade \
5+
&& apk add openjdk17-jre-headless \
6+
&& apk add --update bash \
7+
&& rm -rf /var/cache/apk/*
8+
9+
################################################################################
10+
11+
FROM base AS build
12+
13+
ARG OPENVOXSERVER_VERSION=8.8.1
14+
ARG OPENVOXDB_VERSION=8.9.1
15+
16+
ADD https://artifacts.voxpupuli.org/openvox-server/${OPENVOXSERVER_VERSION}/openvox-server-${OPENVOXSERVER_VERSION}.tar.gz /
17+
ADD https://artifacts.voxpupuli.org/openvoxdb/${OPENVOXDB_VERSION}/openvoxdb-${OPENVOXDB_VERSION}.tar.gz /
18+
19+
ENV apps_dir=/opt/puppetlabs/server/apps
20+
ENV app_logdir=/var/log/puppetlabs
21+
ENV data_dir=/opt/puppetlabs/server/data
22+
ENV etc_dir=/etc/puppetlabs
23+
ENV run_dir=/var/run/puppetlabs
24+
ENV bindir=/opt/puppetlabs/server/apps/puppetserver/bin
25+
ENV symbindir=/opt/puppetlabs/server/bin
26+
ENV uxbindir=/opt/puppetlabs/bin
27+
ENV rubylibdir=/opt/puppetlabs/puppet/lib/ruby/vendor_ruby
28+
29+
RUN apk update \
30+
&& tar -xzf /openvox-server-${OPENVOXSERVER_VERSION}.tar.gz \
31+
&& tar -xzf /openvoxdb-${OPENVOXDB_VERSION}.tar.gz \
32+
&& cd /puppetserver-${OPENVOXSERVER_VERSION} \
33+
&& install -d -m 0755 "${apps_dir}/puppetserver" \
34+
&& install -d -m 0770 "${data_dir}/puppetserver" \
35+
&& install -m 0644 puppet-server-release.jar "${apps_dir}/puppetserver" \
36+
&& install -m 0774 ext/ezbake-functions.sh "${apps_dir}/puppetserver" \
37+
&& install -m 0644 ext/ezbake.manifest "${apps_dir}/puppetserver" \
38+
&& install -d -m 0755 "${etc_dir}/puppetserver/conf.d" \
39+
&& install -d -m 0755 "${etc_dir}/puppetserver/services.d" \
40+
&& install -d -m 0755 "${apps_dir}/puppetserver/config/services.d" \
41+
&& install -m 0644 ext/system-config/services.d/bootstrap.cfg "${apps_dir}/puppetserver/config/services.d/bootstrap.cfg" \
42+
&& install -m 0644 ext/config/request-logging.xml "${etc_dir}/puppetserver/request-logging.xml" \
43+
&& install -m 0644 ext/config/conf.d/puppetserver.conf "${etc_dir}/puppetserver/conf.d/puppetserver.conf" \
44+
&& install -m 0644 ext/config/logback.xml "${etc_dir}/puppetserver/logback.xml" \
45+
&& install -m 0644 ext/config/services.d/ca.cfg "${etc_dir}/puppetserver/services.d/ca.cfg" \
46+
&& install -m 0644 ext/config/conf.d/global.conf "${etc_dir}/puppetserver/conf.d/global.conf" \
47+
&& install -m 0644 ext/config/conf.d/web-routes.conf "${etc_dir}/puppetserver/conf.d/web-routes.conf" \
48+
&& install -m 0644 ext/config/conf.d/auth.conf "${etc_dir}/puppetserver/conf.d/auth.conf" \
49+
&& install -m 0644 ext/config/conf.d/metrics.conf "${etc_dir}/puppetserver/conf.d/metrics.conf" \
50+
&& install -m 0644 ext/config/conf.d/ca.conf "${etc_dir}/puppetserver/conf.d/ca.conf" \
51+
&& install -m 0644 ext/config/conf.d/webserver.conf "${etc_dir}/puppetserver/conf.d/webserver.conf" \
52+
&& install -d -m 0755 "${apps_dir}/puppetserver/cli" \
53+
&& install -d -m 0755 "${apps_dir}/puppetserver/cli/apps" \
54+
&& install -d -m 0755 "${bindir}" \
55+
&& install -d -m 0755 "${symbindir}" \
56+
&& install -d -m 0755 "${uxbindir}" \
57+
&& install -m 0755 "ext/bin/puppetserver" "${bindir}/puppetserver" \
58+
&& ln -s "../apps/puppetserver/bin/puppetserver" "${symbindir}/puppetserver" \
59+
&& ln -s "../server/apps/puppetserver/bin/puppetserver" "${uxbindir}/puppetserver" \
60+
&& install -m 0755 ext/cli/foreground "${apps_dir}/puppetserver/cli/apps/foreground" \
61+
&& install -m 0755 ext/cli/dropsonde "${apps_dir}/puppetserver/cli/apps/dropsonde" \
62+
&& install -m 0755 ext/cli/ca "${apps_dir}/puppetserver/cli/apps/ca" \
63+
&& install -m 0755 ext/cli/irb "${apps_dir}/puppetserver/cli/apps/irb" \
64+
&& install -m 0755 ext/cli/gem "${apps_dir}/puppetserver/cli/apps/gem" \
65+
&& install -m 0755 ext/cli/reload "${apps_dir}/puppetserver/cli/apps/reload" \
66+
&& install -m 0755 ext/cli/ruby "${apps_dir}/puppetserver/cli/apps/ruby" \
67+
&& install -m 0755 ext/cli/stop "${apps_dir}/puppetserver/cli/apps/stop" \
68+
&& install -m 0755 ext/cli/start "${apps_dir}/puppetserver/cli/apps/start" \
69+
&& install -m 0755 ext/cli_defaults/cli-defaults.sh "${apps_dir}/puppetserver/cli" \
70+
&& install -d -m 0700 "${app_logdir}/puppetserver" \
71+
&& install -d -m 0755 "${run_dir}/puppetserver" \
72+
&& install -d -m 700 "${data_dir}/puppetserver/jars" \
73+
&& install -d -m 700 "${data_dir}/puppetserver/yaml" \
74+
&& install -d /opt/puppetlabs/server/data/puppetserver/jruby-gems \
75+
&& install -d -m=775 /opt/puppetlabs/server/data \
76+
&& install -d "${etc_dir}/puppet/ssl" \
77+
&& install -d -m=755 "${etc_dir}/code" \
78+
&& install -d "${etc_dir}/puppetserver/ca" \
79+
&& bash ext/build-scripts/install-vendored-gems.sh \
80+
### puppetdb-termini
81+
&& cd /puppetdb-${OPENVOXDB_VERSION} \
82+
&& install -Dm 0644 puppet/face/node/deactivate.rb "${rubylibdir}/puppet/face/node/deactivate.rb" \
83+
&& install -Dm 0644 puppet/face/node/status.rb "${rubylibdir}/puppet/face/node/status.rb" \
84+
&& install -Dm 0644 puppet/functions/puppetdb_query.rb "${rubylibdir}/puppet/functions/puppetdb_query.rb" \
85+
&& install -Dm 0644 puppet/indirector/catalog/puppetdb.rb "${rubylibdir}/puppet/indirector/catalog/puppetdb.rb" \
86+
&& install -Dm 0644 puppet/indirector/facts/puppetdb_apply.rb "${rubylibdir}/puppet/indirector/facts/puppetdb_apply.rb" \
87+
&& install -Dm 0644 puppet/indirector/facts/puppetdb.rb "${rubylibdir}/puppet/indirector/facts/puppetdb.rb" \
88+
&& install -Dm 0644 puppet/indirector/node/puppetdb.rb "${rubylibdir}/puppet/indirector/node/puppetdb.rb" \
89+
&& install -Dm 0644 puppet/indirector/resource/puppetdb.rb "${rubylibdir}/puppet/indirector/resource/puppetdb.rb" \
90+
&& install -Dm 0644 puppet/reports/puppetdb.rb "${rubylibdir}/puppet/reports/puppetdb.rb" \
91+
&& install -Dm 0644 puppet/util/puppetdb.rb "${rubylibdir}/puppet/util/puppetdb.rb" \
92+
&& install -Dm 0644 puppet/util/puppetdb/atom.rb "${rubylibdir}/puppet/util/puppetdb/atom.rb" \
93+
&& install -Dm 0644 puppet/util/puppetdb/char_encoding.rb "${rubylibdir}/puppet/util/puppetdb/char_encoding.rb" \
94+
&& install -Dm 0644 puppet/util/puppetdb/command_names.rb "${rubylibdir}/puppet/util/puppetdb/command_names.rb" \
95+
&& install -Dm 0644 puppet/util/puppetdb/command.rb "${rubylibdir}/puppet/util/puppetdb/command.rb" \
96+
&& install -Dm 0644 puppet/util/puppetdb/config.rb "${rubylibdir}/puppet/util/puppetdb/config.rb" \
97+
&& install -Dm 0644 puppet/util/puppetdb/http.rb "${rubylibdir}/puppet/util/puppetdb/http.rb"
98+
99+
################################################################################
100+
101+
FROM base AS final
102+
103+
ARG vcs_ref
104+
ARG build_date
105+
ARG R10K_VERSION=5.0.0
106+
107+
LABEL org.label-schema.maintainer="Voxpupuli Team <voxpupuli@groups.io>" \
108+
org.label-schema.vendor="OpenVoxProject" \
109+
org.label-schema.url="https://github.com/OpenVoxProject/container-openvoxserver" \
110+
org.label-schema.vcs-url="https://github.com/OpenVoxProject/container-openvoxserver" \
111+
org.label-schema.schema-version="1.0" \
112+
org.label-schema.dockerfile="/Containerfile.alpine" \
113+
org.label-schema.name="OpenVox Server ($build_type)" \
114+
org.label-schema.version="$OPENVOXSERVER_VERSION" \
115+
org.label-schema.vcs-ref="$vcs_ref" \
116+
org.label-schema.build-date="$build_date"
117+
118+
ENV AUTOSIGN=true \
119+
CA_ALLOW_SUBJECT_ALT_NAMES=false \
120+
CA_ENABLED=true \
121+
CA_TTL=157680000 \
122+
CA_HOSTNAME=puppet \
123+
CA_PORT=8140 \
124+
CERTNAME="" \
125+
CSR_ATTRIBUTES='{}' \
126+
DEBIAN_FRONTEND=noninteractive \
127+
DNS_ALT_NAMES="" \
128+
ENVIRONMENTPATH=/etc/puppetlabs/code/environments \
129+
HIERACONFIG='$confdir/hiera.yaml' \
130+
INTERMEDIATE_CA_BUNDLE=/etc/puppetlabs/intermediate/ca.pem \
131+
INTERMEDIATE_CA_KEY=/etc/puppetlabs/intermediate/key.pem \
132+
INTERMEDIATE_CA=false \
133+
INTERMEDIATE_CRL_CHAIN=/etc/puppetlabs/intermediate/crl.pem \
134+
LOGDIR=/var/log/puppetlabs/puppetserver \
135+
OPENVOX_REPORTS="puppetdb" \
136+
OPENVOX_STORECONFIGS_BACKEND="puppetdb" \
137+
OPENVOX_STORECONFIGS=true \
138+
OPENVOXDB_SERVER_URLS=https://openvoxdb:8081 \
139+
OPENVOXSERVER_ENABLE_ENV_CACHE_DEL_API=true \
140+
OPENVOXSERVER_ENVIRONMENT_TIMEOUT=unlimited \
141+
OPENVOXSERVER_GRAPHITE_EXPORTER_ENABLED=false \
142+
OPENVOXSERVER_GRAPHITE_HOST=exporter \
143+
OPENVOXSERVER_GRAPHITE_PORT=9109 \
144+
OPENVOXSERVER_HOSTNAME="" \
145+
OPENVOXSERVER_JAVA_ARGS="-Xms1024m -Xmx1024m" \
146+
OPENVOXSERVER_MAX_ACTIVE_INSTANCES=1 \
147+
OPENVOXSERVER_MAX_REQUESTS_PER_INSTANCE=0 \
148+
OPENVOXSERVER_PORT=8140 \
149+
PATH=$PATH:/opt/puppetlabs/server/bin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/bin \
150+
SSLDIR=/etc/puppetlabs/puppet/ssl \
151+
USE_OPENVOXDB=true \
152+
### build variables
153+
apps_dir=/opt/puppetlabs/server/apps \
154+
app_logdir=/var/log/puppetlabs \
155+
data_dir=/opt/puppetlabs/server/data \
156+
etc_dir=/etc/puppetlabs \
157+
run_dir=/var/run/puppetlabs \
158+
bindir=/opt/puppetlabs/server/apps/puppetserver/bin \
159+
symbindir=/opt/puppetlabs/server/bin \
160+
uxbindir=/opt/puppetlabs/bin
161+
162+
COPY --from=build /opt/puppetlabs /opt/puppetlabs
163+
COPY --from=build /etc/puppetlabs /etc/puppetlabs
164+
COPY --from=build /var/log/puppetlabs /var/log/puppetlabs
165+
COPY --from=build /var/run/puppetlabs /var/run/puppetlabs
166+
167+
COPY docker-entrypoint.sh \
168+
healthcheck.sh \
169+
Containerfile.alpine \
170+
/
171+
172+
COPY conf.d/product.conf /etc/puppetlabs/puppetserver/conf.d/
173+
COPY conf.d/puppetserver.conf /etc/puppetlabs/puppetserver/conf.d/
174+
COPY docker-entrypoint.d /docker-entrypoint.d
175+
COPY logback.xml /etc/puppetlabs/puppetserver/
176+
COPY puppetdb.conf /var/tmp/puppet/
177+
COPY puppetserver /etc/default/puppetserver
178+
COPY request-logging.xml /etc/puppetlabs/puppetserver/
179+
180+
RUN apk update \
181+
&& apk add --update dumb-init \
182+
&& apk add --update alpine-sdk \
183+
&& apk add --update openssh-client \
184+
&& apk add --update openssl \
185+
&& apk add --update libssh2 \
186+
&& apk add --update ruby \
187+
&& apk add --update ruby-dev \
188+
# && apk add --update cmake \
189+
# install puppet gem as agent into system ruby
190+
&& gem install --no-doc puppet -v 8.10.0 \
191+
&& gem install --no-doc hocon -v 1.4.0 \
192+
&& gem install --no-doc racc -v 1.8.1 \
193+
&& gem install --no-doc r10k -v ${R10K_VERSION} \
194+
&& gem install --no-doc hiera-eyaml -v 4.1.0 \
195+
&& gem install --no-doc puppetserver-ca -v 2.6.0 \
196+
# && gem install --no-doc rugged -- --with-ssh \
197+
&& apk del --purge alpine-sdk \
198+
&& addgroup -g 1001 puppet \
199+
&& adduser -G puppet -u 1001 -h ${data_dir}/puppetserver -H -D -s /sbin/nologin puppet \
200+
&& chown -R puppet:puppet ${etc_dir}/code \
201+
&& chown -R puppet:puppet ${etc_dir}/puppet/ssl \
202+
&& chown -R puppet:puppet ${etc_dir}/puppetserver/ca \
203+
&& chown -R puppet:puppet ${app_logdir}/puppetserver \
204+
&& chown -R puppet:puppet ${run_dir}/puppetserver \
205+
&& chown -R puppet:puppet ${data_dir}/puppetserver \
206+
&& chmod 700 ${app_logdir}/puppetserver \
207+
&& chmod 770 ${data_dir}/puppetserver \
208+
&& chmod 750 ${etc_dir}/puppetserver \
209+
&& chmod 700 ${data_dir}/puppetserver/jars \
210+
&& chmod 700 ${data_dir}/puppetserver/yaml \
211+
&& find /etc/puppetlabs/puppet/ssl -type d -print0 | xargs -0 chmod 770 \
212+
&& echo 'alias ll="ls -la --color=auto"' >> ~/.bashrc \
213+
&& chmod +x /docker-entrypoint.sh /healthcheck.sh /docker-entrypoint.d/*.sh \
214+
&& mkdir -p /opt/puppetlabs/puppet/bin \
215+
&& ln -s /usr/bin/puppet /opt/puppetlabs/puppet/bin/puppet \
216+
&& ln -s /usr/bin/facter /opt/puppetlabs/puppet/bin/facter \
217+
&& ln -s /usr/bin/ruby /opt/puppetlabs/puppet/bin/ruby \
218+
&& ln -s /usr/bin/gem /opt/puppetlabs/puppet/bin/gem \
219+
&& ln -s /usr/bin/irb /opt/puppetlabs/puppet/bin/irb \
220+
&& ln -s /usr/bin/erb /opt/puppetlabs/puppet/bin/erb \
221+
&& ln -s /usr/bin/r10k /opt/puppetlabs/puppet/bin/r10k \
222+
&& ln -s /usr/bin/hiera-eyaml /opt/puppetlabs/puppet/bin/hiera-eyaml \
223+
# install puppet gem as library into jruby loadpath
224+
&& puppetserver gem install puppet
225+
226+
# k8s uses livenessProbe, startupProbe, readinessProbe and ignores HEALTHCHECK
227+
HEALTHCHECK --interval=20s --timeout=15s --retries=12 --start-period=3m CMD ["/healthcheck.sh"]
228+
229+
EXPOSE 8140
230+
231+
ENTRYPOINT ["dumb-init", "/docker-entrypoint.sh"]
232+
CMD ["foreground"]

0 commit comments

Comments
 (0)