Skip to content

Commit 6da577c

Browse files
committed
- [build](Dockerfile) Switch to php82 and make it a build argument: --build-arg PHP_VER=php82.
- [build](Makefile) Now set `DOCKER_BUILDKIT=1` since we don't use special symbolic links. - [docker](src/docker) Improve debug message in [docker-service.sh](src/docker/bin/docker-service.sh).
1 parent 4969253 commit 6da577c

File tree

9 files changed

+39
-23
lines changed

9 files changed

+39
-23
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 1.1.7
2+
3+
- [build](Dockerfile) Switch to php82 and make it a build argument: `--build-arg PHP_VER=php82`.
4+
- [build](Makefile) Now set `DOCKER_BUILDKIT=1` since we don't use special symbolic links.
5+
- [docker](src/docker) Improve debug message in [docker-service.sh](src/docker/bin/docker-service.sh).
6+
17
# 1.1.6
28

39
- [build](Makefile) Now use alpine:3.18 (asterisk:18.15.1).

Dockerfile

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG DIST=alpine
2-
ARG REL=latest
1+
ARG DIST=alpine
2+
ARG REL=latest
33

44

55
#
@@ -11,14 +11,16 @@ ARG REL=latest
1111
#
1212

1313
FROM $DIST:$REL AS mini
14+
ARG PHP_VER=php82
1415
LABEL maintainer=mlan
1516

16-
ENV SVDIR=/etc/service \
17+
ENV PHP_VER=$PHP_VER \
18+
SVDIR=/etc/service \
1719
DOCKER_PERSIST_DIR=/srv \
1820
DOCKER_BIN_DIR=/usr/local/bin \
1921
DOCKER_ENTRY_DIR=/etc/docker/entry.d \
2022
DOCKER_EXIT_DIR=/etc/docker/exit.d \
21-
DOCKER_PHP_DIR=/usr/share/php81 \
23+
DOCKER_PHP_DIR=/usr/share/$PHP_VER \
2224
DOCKER_SPOOL_DIR=/var/spool/asterisk \
2325
DOCKER_CONF_DIR=/etc/asterisk \
2426
DOCKER_LOG_DIR=/var/log/asterisk \
@@ -62,6 +64,8 @@ RUN source docker-common.sh \
6264
$DOCKER_NFT_DIR \
6365
$DOCKER_SPOOL_DIR \
6466
&& mkdir -p $DOCKER_ACME_SSL_DIR \
67+
&& ln -sf $DOCKER_PHP_DIR/autoban.php $DOCKER_BIN_DIR/autoban \
68+
&& ln -sf $DOCKER_PHP_DIR/websms.php $DOCKER_BIN_DIR/websms \
6569
&& apk --no-cache --update add \
6670
asterisk
6771

@@ -93,13 +97,14 @@ RUN apk --no-cache --update add \
9397
asterisk-srtp \
9498
openssl \
9599
curl \
96-
php81 \
97-
php81-curl \
98-
php81-json \
100+
$PHP_VER \
101+
$PHP_VER-curl \
102+
$PHP_VER-json \
99103
runit \
100104
bash \
101105
nftables \
102106
jq \
107+
&& ln -sf /usr/bin/$PHP_VER /usr/bin/php \
103108
&& docker-service.sh \
104109
"syslogd -nO- -l$SYSLOG_LEVEL $SYSLOG_OPTIONS" \
105110
"crond -f -c /etc/crontabs" \

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BLD_TGTS ?= mini base full xtra
1313
BLD_CMT ?= HEAD
1414
BLD_CVER ?= ast160
1515
BLD_DNLD ?= curl -o
16-
BLD_KIT ?= DOCKER_BUILDKIT=0
16+
BLD_KIT ?= DOCKER_BUILDKIT=1
1717

1818
TST_REPO ?= $(BLD_REPO)
1919
TST_VER ?= $(BLD_VER)
@@ -79,7 +79,7 @@ prune:
7979
docker image prune -f
8080

8181
clean:
82-
docker images | grep $(BLD_REPO) | awk '{print $$1 ":" $$2}' | uniq | xargs docker rmi
82+
docker images | grep $(BLD_REPO) | awk '{print $$1 ":" $$2}' | uniq | xargs docker rmi || true
8383

8484
$(TST_TGTE):
8585
${MAKE} $(TST_ENV) $@

demo/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ tools_install:
116116
pulseaudio-utils alsa-utils
117117

118118
xdebug_install:
119+
$(eval PHP_VER=$(shell docker compose exec $(SRV_NAME) sh -c 'echo $$PHP_VER'))
119120
docker compose exec $(SRV_NAME) apk --no-cache --update add \
120-
php8-pecl-xdebug
121-
docker compose exec $(SRV_NAME) sed -i '1 a xdebug.profiler_enable = 1' /etc/php81/php.ini
122-
docker compose exec $(SRV_NAME) sed -i '2 a zend_extension=xdebug.so' /etc/php81/conf.d/50_xdebug.ini
121+
$(PHP_VER)-pecl-xdebug
122+
docker compose exec $(SRV_NAME) sed -i '1 a xdebug.profiler_enable = 1' /etc/$(PHP_VER)/php.ini
123+
docker compose exec $(SRV_NAME) sed -i '2 a zend_extension=xdebug.so' /etc/$(PHP_VER)/conf.d/50_xdebug.ini
123124
docker compose exec $(SRV_NAME) sv restart websmsd autoband
124125

125126
xdebug_getdata:

dkr.mk

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ dkr_cnt_pid = $(shell docker inspect --format '{{.State.Pid}}' $(1))
2828
# '{{range .NetworkSettings.Networks}}{{println .IPAddress}}{{end}}' \
2929
# $(1) | head -n1)
3030

31+
#
32+
# $(call dkr_img_env,image,envvar) -> value
33+
#
34+
dkr_img_env = $(shell docker inspect -f \
35+
'{{range .Config.Env}}{{println .}}{{end}}' $(1) | grep -P "^$(2)=" | sed 's/[^=]*=//'
3136
#
3237
# List IPs of containers
3338
#

src/autoban/bin/autoban

-1
This file was deleted.

src/docker/bin/docker-service.sh

+9-8
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,25 @@ init_service() {
7575
esac
7676
done
7777
shift $((OPTIND -1))
78-
cmd=$(which "$1")
79-
sv_name=${sv_name-$(base_name $1)}
78+
cmd=$1
79+
cmd_path=$(which "$cmd")
80+
sv_name=${sv_name-$(base_name $cmd)}
8081
runsv_dir=$SVDIR/$sv_name
8182
svlog_dir=$DOCKER_SVLOG_DIR/$sv_name
8283
if [ -n "$sv_force" ]; then
8384
forcepid="$(echo rm -f $(pid_name $sv_name)*)"
8485
fi
8586
shift
86-
if [ ! -z "$cmd" ]; then
87-
dc_log 5 "Setting up ($sv_name) options ($options) args ($@)"
87+
if [ ! -z "$cmd_path" ]; then
88+
dc_log 5 "Setting up ($sv_name) options ($options) cmd ($cmd_path) args ($@)"
8889
mkdir -p $runsv_dir
8990
cat <<-!cat > $runsv_dir/run
9091
#!/bin/sh -e
9192
exec 2>&1
9293
$forcepid
9394
$redirstd
9495
$sourcefile
95-
exec $cmd $@
96+
exec $cmd_path $@
9697
!cat
9798
chmod +x $runsv_dir/run
9899
if [ -n "$sv_down" ]; then
@@ -107,14 +108,14 @@ init_service() {
107108
chmod +x $runsv_dir/log/run
108109
fi
109110
else
110-
dc_log 4 "Cannot find command."
111+
dc_log 4 "Cannot find command: $cmd"
111112
fi
112113
}
113114

114115
#
115116
# run
116117
#
117118

118-
for cmd in "$@" ; do
119-
init_service $cmd
119+
for args in "$@" ; do
120+
init_service $args
120121
done

src/websms/bin/websms

-1
This file was deleted.

test/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ test-logs_%:
115115
docker container logs $(PBX_NAME) | grep 'docker-entrypoint.sh' || true
116116

117117
test-wait_%:
118-
case $* in [1-3]) sleep $(TST_W8S);; [4-9]) sleep $(TST_W8L);; esac
118+
case $* in [1-2]) sleep $(TST_W8S);; [3-9]) sleep $(TST_W8L);; esac
119119

120120
test-up-net:
121121
docker network create $(NET_NAME) 2>/dev/null || true

0 commit comments

Comments
 (0)