Skip to content

Commit f2a515a

Browse files
asterisk-release-automation[bot]github-actions[bot]andrius
authored
Alpine apk sync (#192)
* chore(alpine): sync apk index into the build matrix Auto-generated by Sync Alpine apk Index (run 37975282991). * test(golden): pin the Alpine cert leg to 22.8-cert4 alpine-sync moved the only Alpine cert member from the deprecated 22.8-cert3 to 22.8-cert4, so 22.8-cert3 has nothing left to build and its golden case failed with 'No build targets found'. The golden set keeps one Alpine cert leg (4-component apk pin, subpackage-omission path), now on 22.8-cert4. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Andrius Kairiukstis <k@c0.lt>
1 parent 6db746d commit f2a515a

7 files changed

Lines changed: 384 additions & 13 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Alpine Asterisk image - installs prebuilt, signed apks from the sibling
2+
# project's Cloudsmith repository (andrius/asterisk-alpine). There is no build
3+
# stage: the .apk already contains the compiled, module-selected Asterisk.
4+
# Generated from YAML configuration - DO NOT EDIT MANUALLY
5+
FROM alpine:3.24
6+
7+
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
8+
LABEL org.opencontainers.image.title="Asterisk PBX"
9+
LABEL org.opencontainers.image.description="Asterisk PBX 22.8-cert4 on Alpine (apk)"
10+
LABEL org.opencontainers.image.version="22.8-cert4"
11+
LABEL org.opencontainers.image.source="https://github.com/andrius/asterisk"
12+
LABEL org.opencontainers.image.vendor="Andrius Kairiukstis <k@andrius.mobi>"
13+
14+
# Trust the Cloudsmith repository signing key (vendored; copied into the build
15+
# context alongside this Dockerfile).
16+
COPY cloudsmith-asterisk-alpine.rsa.pub /etc/apk/keys/alpine@asterisk-25B0C9A992BE0CEF.rsa.pub
17+
18+
# Add the pinned apk repository and install Asterisk + the selected subpackages
19+
# at an exact version, plus the runtime tools the entrypoint/healthcheck need.
20+
# The @andrius-asterisk tag keeps these from clashing with Alpine's own
21+
# asterisk in the main repo; the exact "=version-rN" pin makes rebuilds
22+
# reproducible (or fail loudly if the apk was pruned).
23+
RUN echo "@andrius-asterisk https://dl.cloudsmith.io/public/asterisk/alpine/alpine/v3.24/main" >>/etc/apk/repositories \
24+
&& apk add --no-cache \
25+
"asterisk@andrius-asterisk=22.8.0.4-r1" \
26+
"asterisk-sample-config@andrius-asterisk=22.8.0.4-r1" \
27+
"asterisk-opus@andrius-asterisk=22.8.0.4-r1" \
28+
"asterisk-srtp@andrius-asterisk=22.8.0.4-r1" \
29+
"asterisk-curl@andrius-asterisk=22.8.0.4-r1" \
30+
"asterisk-speex@andrius-asterisk=22.8.0.4-r1" \
31+
"asterisk-fax@andrius-asterisk=22.8.0.4-r1" \
32+
"asterisk-odbc@andrius-asterisk=22.8.0.4-r1" \
33+
"asterisk-mobile@andrius-asterisk=22.8.0.4-r1" \
34+
bash \
35+
shadow \
36+
gettext \
37+
procps \
38+
ca-certificates \
39+
curl \
40+
tzdata \
41+
&& asterisk -V
42+
43+
# The asterisk apk creates the asterisk user (uid 100, home /var/lib/asterisk).
44+
# Normalize it to the Debian image's identity (uid/gid 1000, home
45+
# /home/asterisk, bash shell) so both image families behave identically and
46+
# cloud/orchestration setups see a consistent uid. The entrypoint's PUID/PGID
47+
# remap then no-ops on the default, exactly as on Debian.
48+
RUN groupmod -g 1000 asterisk \
49+
&& usermod -u 1000 -g 1000 -d /home/asterisk -s /bin/bash asterisk \
50+
&& mkdir -p \
51+
/home/asterisk \
52+
/var/run/asterisk \
53+
/var/log/asterisk \
54+
/var/spool/asterisk/monitor \
55+
/var/spool/asterisk/outgoing \
56+
/var/spool/asterisk/tmp \
57+
/var/spool/asterisk/voicemail \
58+
/var/spool/asterisk/fax \
59+
/var/lib/asterisk/keys \
60+
/var/lib/asterisk/phoneprov \
61+
/var/lib/asterisk/sounds \
62+
/var/lib/asterisk/docs
63+
64+
# Healthcheck + entrypoint (the shared bash partials; bash + shadow are
65+
# installed above so usermod/groupmod PUID/PGID remap works unchanged).
66+
COPY healthcheck.sh /usr/local/bin/healthcheck.sh
67+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
68+
RUN chmod +x /usr/local/bin/healthcheck.sh /usr/local/bin/entrypoint.sh \
69+
&& chown -R asterisk:asterisk \
70+
/etc/asterisk \
71+
/home/asterisk \
72+
/var/lib/asterisk \
73+
/var/log/asterisk \
74+
/var/spool/asterisk \
75+
/var/run/asterisk \
76+
&& chmod -R 750 /var/spool/asterisk
77+
78+
# Networking (documented; publish explicitly at run time).
79+
# EXPOSE 5060/udp
80+
# EXPOSE 5060/tcp
81+
# EXPOSE 10000-20000/udp
82+
VOLUME ["/var/lib/asterisk/sounds", "/var/lib/asterisk/keys", "/var/lib/asterisk/phoneprov", "/var/spool/asterisk", "/var/log/asterisk", "/etc/asterisk"]
83+
# Health check
84+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
85+
CMD /usr/local/bin/healthcheck.sh
86+
87+
# Entrypoint runs as root, remaps the asterisk uid/gid to PUID/PGID, then execs
88+
# CMD. Asterisk drops privileges itself via the -U/-p flags below.
89+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
90+
WORKDIR /home/asterisk
91+
CMD ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "asterisk", "-p"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAu5GYPGV/b1+giz7rgDN6
3+
bkeFqT8zMHBzJ051SdVT4MbF/A6ap0hyhHDKc3o2T06Ete/vde2DjZj+RUKP1bP+
4+
Ywamb6waQqAJsGDJ86tSsJ6eklX8N88j9Mggyx3WXu6JGrigY6i0u/7QUMXV9KAL
5+
E2r902YoqZHn6F8FITD2VXB9NwIyMfiLsGnTmLkehhrVPupx9Qdo3URtCagYbYMh
6+
hIScUGr1i1LKQaTSgyOCCF9sdReJuj2OT8BUuBWmIxWg4nxmx8rndllUMseYEG/q
7+
M7dYMjLNShL6u4WNMb0hwKaYKHy69PtVBSUnLu0Y3rrH2oLo/B4XGyyX7jGw3pjx
8+
rq1bHE2nkgGV3OjXE/ZT7oLDYZtriZHYEEdBJwFr1SHyevOlcsNqdkiskwpE/TH4
9+
dxnIhMYJ8LYw1o5OQV6oSGpV/Mk3aYvMKyc00hZ8PjfWQkgxrkpQ4HRymp74bB1Z
10+
M6AAzp1WcmZ3lR5ZLhAClXbwSetLrXACavIS07clOoNXAgMBAAE=
11+
-----END PUBLIC KEY-----
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# Asterisk container entrypoint
3+
# Generated from template for 22.8-cert4
4+
#
5+
# Adapts the in-container `asterisk` user (default uid:gid 1000:1000) to the
6+
# uid/gid supplied via PUID / PGID env vars, then chowns runtime directories
7+
# so bind-mounted volumes are writable. Asterisk drops privileges itself via
8+
# its `-U asterisk -p` CMD flags, so no gosu/su-exec is needed.
9+
#
10+
# When the container is launched with `--user N:M` (compose `user:`), this
11+
# script runs as that user instead of root: the adapt/chown branch is skipped
12+
# and "$@" is exec'd as-is, matching pre-entrypoint behaviour.
13+
14+
set -e
15+
16+
PUID="${PUID:-1000}"
17+
PGID="${PGID:-1000}"
18+
19+
if [ "$(id -u)" = "0" ]; then
20+
current_uid="$(id -u asterisk)"
21+
current_gid="$(id -g asterisk)"
22+
23+
if [ "$PGID" != "$current_gid" ]; then
24+
groupmod -o -g "$PGID" asterisk
25+
fi
26+
if [ "$PUID" != "$current_uid" ]; then
27+
usermod -o -u "$PUID" -g "$PGID" asterisk
28+
fi
29+
30+
for path in /etc/asterisk /home/asterisk /var/lib/asterisk \
31+
/var/log/asterisk /var/spool/asterisk /var/run/asterisk; do
32+
[ -d "$path" ] || continue
33+
if [ "$(stat -c '%u:%g' "$path" 2>/dev/null)" != "$PUID:$PGID" ]; then
34+
chown -R "$PUID:$PGID" "$path" 2>/dev/null || true
35+
fi
36+
done
37+
fi
38+
39+
# Replace the baked-in -W (light-background adjust) with whatever the user
40+
# supplies via ASTERISK_TERMINAL_OPTS. Use cases (issue #16):
41+
# ASTERISK_TERMINAL_OPTS="" -> drop -W, let the terminal decide
42+
# ASTERISK_TERMINAL_OPTS="-B" -> force black background (dark terminals)
43+
# ASTERISK_TERMINAL_OPTS="-n" -> disable colors entirely (safest in logs)
44+
# (unset) -> keep -W (existing behaviour)
45+
if [ -n "${ASTERISK_TERMINAL_OPTS+x}" ]; then
46+
new_args=()
47+
for arg in "$@"; do
48+
if [ "$arg" = "-W" ]; then
49+
for opt in $ASTERISK_TERMINAL_OPTS; do
50+
new_args+=("$opt")
51+
done
52+
else
53+
new_args+=("$arg")
54+
fi
55+
done
56+
set -- "${new_args[@]}"
57+
fi
58+
59+
exec "$@"
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#!/bin/bash
2+
# Asterisk health check script
3+
# Generated from template for 22.8-cert4
4+
5+
set -euo pipefail
6+
7+
# Configuration
8+
ASTERISK_CLI="/usr/sbin/asterisk -rx"
9+
TIMEOUT=10
10+
VERBOSE=false
11+
12+
# Parse command line arguments
13+
while [[ $# -gt 0 ]]; do
14+
case $1 in
15+
-v|--verbose)
16+
VERBOSE=true
17+
shift
18+
;;
19+
-t|--timeout)
20+
TIMEOUT="$2"
21+
shift 2
22+
;;
23+
*)
24+
echo "Unknown option: $1" >&2
25+
exit 1
26+
;;
27+
esac
28+
done
29+
30+
# Logging functions
31+
log() {
32+
if [[ "$VERBOSE" == "true" ]]; then
33+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" >&2
34+
fi
35+
}
36+
37+
error() {
38+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $*" >&2
39+
}
40+
41+
# Health check functions
42+
check_asterisk_running() {
43+
log "Checking if Asterisk is running..."
44+
if ! pgrep -x asterisk >/dev/null; then
45+
error "Asterisk process not found"
46+
return 1
47+
fi
48+
log "✓ Asterisk process is running"
49+
return 0
50+
}
51+
52+
check_asterisk_responsive() {
53+
log "Checking if Asterisk CLI is responsive..."
54+
if ! timeout $TIMEOUT $ASTERISK_CLI "core show version" >/dev/null 2>&1; then
55+
error "Asterisk CLI not responsive"
56+
return 1
57+
fi
58+
log "✓ Asterisk CLI is responsive"
59+
return 0
60+
}
61+
62+
check_pjsip_status() {
63+
log "Checking PJSIP status..."
64+
if ! timeout $TIMEOUT $ASTERISK_CLI "pjsip show version" >/dev/null 2>&1; then
65+
error "PJSIP not available or not responding"
66+
return 1
67+
fi
68+
log "✓ PJSIP is available"
69+
return 0
70+
}
71+
72+
check_database_connectivity() {
73+
log "Checking database connectivity..."
74+
# Check if ODBC is configured and working
75+
if ! timeout $TIMEOUT $ASTERISK_CLI "odbc show all" | grep -q "Connected" 2>/dev/null; then
76+
log "⚠ No ODBC connections found (this may be normal)"
77+
else
78+
log "✓ Database connections available"
79+
fi
80+
return 0
81+
}
82+
83+
check_essential_modules() {
84+
log "Checking essential modules..."
85+
local required_modules=(
86+
"res_rtp_asterisk"
87+
"res_timing_timerfd"
88+
"res_crypto"
89+
"res_pjsip"
90+
)
91+
92+
for module in "${required_modules[@]}"; do
93+
local module_output
94+
module_output=$(timeout $TIMEOUT $ASTERISK_CLI "module show like $module" 2>&1)
95+
if ! grep -q "$module" <<<"$module_output"; then
96+
error "Required module $module not loaded"
97+
return 1
98+
fi
99+
done
100+
log "✓ Essential modules are loaded"
101+
return 0
102+
}
103+
104+
check_filesystem_access() {
105+
log "Checking filesystem access..."
106+
local required_dirs=(
107+
"/var/log/asterisk"
108+
"/var/spool/asterisk"
109+
"/var/lib/asterisk"
110+
"/etc/asterisk"
111+
)
112+
113+
for dir in "${required_dirs[@]}"; do
114+
if [[ ! -d "$dir" ]]; then
115+
error "Required directory $dir not found"
116+
return 1
117+
fi
118+
if [[ ! -r "$dir" ]]; then
119+
error "Directory $dir not readable"
120+
return 1
121+
fi
122+
done
123+
log "✓ Filesystem access is working"
124+
return 0
125+
}
126+
127+
# Main health check
128+
main() {
129+
log "Starting Asterisk health check..."
130+
131+
local checks=(
132+
"check_asterisk_running"
133+
"check_asterisk_responsive"
134+
"check_pjsip_status"
135+
"check_database_connectivity"
136+
"check_essential_modules"
137+
"check_filesystem_access"
138+
)
139+
140+
local failed=0
141+
for check in "${checks[@]}"; do
142+
if ! $check; then
143+
failed=$((failed + 1))
144+
fi
145+
done
146+
147+
if [[ $failed -eq 0 ]]; then
148+
log "✓ All health checks passed"
149+
exit 0
150+
else
151+
error "Health check failed: $failed checks failed"
152+
exit 1
153+
fi
154+
}
155+
156+
# Handle signals
157+
trap 'error "Health check interrupted"; exit 1' INT TERM
158+
159+
main "$@"

‎asterisk/supported-asterisk-builds.yml‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ latest_builds:
2323
distribution: "edge"
2424
alpine_tree: "edge"
2525
alpine_role: "edge"
26-
apk_version: "24.0.0_git20260810-r1"
26+
apk_version: "24.0.0_git20261005-r1"
2727
apk_packages: ["srtp", "curl", "speex", "fax", "odbc", "ldap", "pgsql", "prometheus", "mobile"]
2828
architectures:
2929
- "amd64"
@@ -553,17 +553,6 @@ latest_builds:
553553
- "amd64"
554554
- "arm64"
555555

556-
- os: "alpine"
557-
distribution: "3.24"
558-
alpine_tree: "v3.24"
559-
alpine_role: "stable"
560-
apk_version: "22.8.0.3-r1"
561-
apk_packages: ["opus", "srtp", "curl", "speex", "fax", "odbc", "mobile"]
562-
architectures:
563-
- "amd64"
564-
- "arm64"
565-
- "armv7"
566-
- "armhf"
567556
tarball_sha256: "061a4fd3ddd67a553d67c3cf4c2027cec640dd44f2a4e3f1a1765dc8269fcdd2"
568557
superseded_by: "22.8-cert4"
569558
deprecated_at: "2026-08-11T11:25:13Z"
@@ -614,6 +603,17 @@ latest_builds:
614603
- "amd64"
615604
- "arm64"
616605

606+
- os: "alpine"
607+
distribution: "3.24"
608+
alpine_tree: "v3.24"
609+
alpine_role: "stable"
610+
apk_version: "22.8.0.4-r1"
611+
apk_packages: ["opus", "srtp", "curl", "speex", "fax", "odbc", "mobile"]
612+
architectures:
613+
- "amd64"
614+
- "arm64"
615+
- "armv7"
616+
- "armhf"
617617
additional_tags: "22-cert"
618618
- version: "20.21.0"
619619
tarball_sha256: "13fd6e8f1fbb19a3174af82a388dd72c87eb2c92d32fca83c4d51bfab03f686a"

0 commit comments

Comments
 (0)