Defined CMD in Dockerfile; ENTRYPOINT now supports user-provided commands
All checks were successful
Update Docker Hub Description / dockerHubDescription (push) Successful in 12s

This commit is contained in:
GianLuca Vagnuzzi
2026-01-02 08:21:38 +01:00
parent 6fc798aa9c
commit aef0ae4dea
4 changed files with 63 additions and 25 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
build.sh build.sh
deploy.sh deploy.sh
data data
compose-test.yml

View File

@@ -36,4 +36,6 @@ RUN set -xe && \
ADD rootfs / ADD rootfs /
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
#CMD ["/usr/sbin/dhcpd -4 -f -d --no-pid -cf /etc/dhcp/dhcpd.conf -lf /etc/dhcp/dhcpd.leases -user dhcpd -group dhcpd"] CMD ["/usr/sbin/dhcpd", "-4", "-f", "-d", "--no-pid", "-cf", "/data/dhcpd4.conf", "-lf", "/data/dhcpd4.leases", "-user", "dhcpd", "-group", "dhcpd"]

View File

@@ -35,15 +35,22 @@ services:
restart: unless-stopped restart: unless-stopped
``` ```
## Changelog ## Changelog
v13.2.443p1-8-1 - 02.01.2026
- Defined CMD in Dockerfile; ENTRYPOINT now supports user-provided commands
v13.2.443p1-8 - 31.12.2025 v13.2.443p1-8 - 31.12.2025
- Debian v.13.2 - Debian v.13.2
- isc-dhcp-server v.4.4.3-P1-8 - isc-dhcp-server v.4.4.3-P1-8
v13.2.443p12 - 31.12.2025 v13.2.443p12 - 31.12.2025
- Debian v. 13.2 - Debian v. 13.2
v.2.0.1 - 08.10.2025 v.2.0.1 - 08.10.2025
- Set env for isc-dhcp-server version in Dockerfile. - Set env for isc-dhcp-server version in Dockerfile.
v2.0.0 - 09.09.2025 v2.0.0 - 09.09.2025
- Debian v.13.1 - Debian v.13.1
v1.0.0 - 25.06.2025 v1.0.0 - 25.06.2025
- Debian v.12.11 - Debian v.12.11
- isc-dhcp-server v.4.4.3-P1-2 - isc-dhcp-server v.4.4.3-P1-2

View File

@@ -39,41 +39,69 @@ function _main {
gid=$(id -g dhcpd) gid=$(id -g dhcpd)
chown -R dhcpd: "/data/dhcpd4.leases" "/data/dhcpd6.leases" chown -R dhcpd: "/data/dhcpd4.leases" "/data/dhcpd6.leases"
export CMDv4="/usr/sbin/dhcpd -4 -f -d --no-pid -cf /data/dhcpd4.conf -lf /data/dhcpd4.leases -user dhcpd -group dhcpd" #export CMDv4="/usr/sbin/dhcpd -4 -f -d --no-pid -cf /data/dhcpd4.conf -lf /data/dhcpd4.leases -user dhcpd -group dhcpd"
export CMDv6="/usr/sbin/dhcpd -6 -f -d --no-pid -cf /data/dhcpd6.conf -lf /data/dhcpd6.leases -user dhcpd -group dhcpd" export CMDv6="/usr/sbin/dhcpd -6 -f -d --no-pid -cf /data/dhcpd6.conf -lf /data/dhcpd6.leases -user dhcpd -group dhcpd"
[ "$DHCP4" = "1" ] && export CMD=$CMDv4
if [ "$DHCP6" = "1" ]; then
[ -z "$CMD" ] && export CMD=$CMDv6 || $CMDv6 &
fi
chown -R dhcpd: "/data" chown -R dhcpd: "/data"
} }
function custom_bashrc { custom_bashrc() {
echo ' cat <<'EOF'
export LS_OPTIONS="--color=auto" export LS_OPTIONS="--color=auto"
alias "ls=ls $LS_OPTIONS" alias ls='ls $LS_OPTIONS'
alias "ll=ls $LS_OPTIONS -la" alias ll='ls $LS_OPTIONS -la'
alias "l=ls $LS_OPTIONS -lA" alias l='ls $LS_OPTIONS -lA'
'
# prompt SOLO per shell interattive
if [[ $- == *i* ]]; then
if [ "$(id -u)" -eq 0 ]; then
PS1="\[\e[35m\][\[\e[31m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]# "
else
PS1="\[\e[35m\][\[\e[33m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]$ "
fi
export PS1
fi
EOF
} }
function _bashrc { setup_bashrc() {
echo "-----------------------------------------" for home in /root /home/*; do
echo " .bashrc file setup..." [ -d "$home" ] || continue
echo "-----------------------------------------" bashrc="$home/.bashrc"
custom_bashrc | tee /root/.bashrc
echo 'export PS1="\[\e[35m\][\[\e[31m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]# "' >> /root/.bashrc # crea se manca
for i in $(ls /home); do echo 'export PS1="\[\e[35m\][\[\e[33m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]$ "' >> /home/${i}/.bashrc; done [ -f "$bashrc" ] || touch "$bashrc"
# evita duplicazioni
grep -q '### CUSTOM BASHRC ###' "$bashrc" && continue
{
echo ''
echo '### CUSTOM BASHRC ###'
custom_bashrc
} >> "$bashrc"
done
} }
#_dirs
_main _main
_bashrc setup_bashrc
#CMD="$@" # If any arguments were passed (i.e., CMD from Dockerfile), store them in CMD
[ -z "$CMD" ] && export CMD="supervisord -c /etc/supervisor/supervisord.conf" [ "$#" -gt 0 ] && CMD="$@"
exec $CMD [ "$DHCP4" = "0" ] && export CMD=""
if [ "$DHCP6" = "1" ]; then
[ -z "$CMD" ] && export CMD=$CMDv6 || $CMDv6 &
fi
exit $? [ -z "$CMD" ] && echo "Warning! DHCP not selected." && exit
# Ensure terminal state is restored and cursor is visible when the container exits
trap 'stty sane 2>/dev/null; tput cnorm 2>/dev/null' EXIT
# print cmd that will be executed
echo "Starting: $*" >&2
# Split CMD into proper arguments and execute
set -- $CMD
exec "$@"