diff --git a/Dockerfile b/Dockerfile index 2267855..50b7b49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,7 +84,7 @@ ENV TERM xterm # Enable systemd init system in the container VOLUME [ "/tmp", "/run", "/run/lock" ] -# Start systemd /lib/systemd/systemd this for systemd to initialize, "log-level=info" is for debugging , "unit=sysinit.target" is for systemd to initialize -CMD [ "/lib/systemd/systemd", "log-level=info", "unit=sysinit.target" ] +# Set the entrypoint +ENTRYPOINT ["docker-entrypoint.sh"] # sudo docker run -d --name klipper -p 8562:80 --privileged --cap-add SYS_ADMIN --security-opt seccomp=unconfined --cgroup-parent=docker.slice --cgroupns private --tmpfs /tmp --tmpfs /run --tmpfs /run/lock klipper \ No newline at end of file diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index c16b642..e5d3e6f 100644 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -6,19 +6,25 @@ cat << "EOF" ██║ ██╔══██╗██║ ██║██╔══╝ ██╔██╗ ███████╗██║ ██║╚██████╔╝███████╗██╔╝ ██╗ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ -╔╗ ┌─┐┌─┐┬┌─┌─┐┬─┐┌─┐┌─┐┌─┐ -╠╩╗├─┤│ ├┴┐├─┤├┬┘│ │└─┐├─┤ -╚═╝┴ ┴└─┘┴ ┴┴ ┴┴└─└─┘└─┘┴ ┴ v0.1.0 +╦╔═┬ ┬┌─┐┌─┐┌─┐┬─┐ +╠╩╗│ │├─┘├─┘├┤ ├┬┘ +╩ ╩┴─┘┴┴ ┴ └─┘┴└─ v1.5.0 EOF -#set -e -#set -x - -if [ "$1" = 'kiauh' ]; then - ./opt/lrgex/kiauh/kiauh.sh +# This script will run on every container start +if ! systemctl is-enabled nginx > /dev/null 2>&1; then + echo "Enabling NGINX..." + systemctl enable nginx +fi +if ! systemctl is-active nginx > /dev/null 2>&1; then + echo "Starting NGINX..." + systemctl start nginx +else + echo "NGINX is already running." fi -/lib/systemd/systemd +# Start systemd /lib/systemd/systemd this for systemd to initialize, "log-level=info" is for debugging , "unit=sysinit.target" is for systemd to initialize +exec /lib/systemd/systemd log-level=info unit=sysinit.target exec "$@" & wait # This is needed to run other scripts or commands when running the container like docker run -it --rm backarosa:latest /bin/bash, backup,restore,container_start,container_stop ..etc #so when you run the container it will run only one command from scripts folder and exit, however commands in line 3 and 4 will run on every docker run - mandatory hard coded - \ No newline at end of file