diff --git a/Dockerfile b/Dockerfile index e421477..b5848c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -166,6 +166,7 @@ RUN echo "Running final commands before cleanup"; \ RUN echo "Deleting unneeded files"; \ $SHELL_OPTS; \ pkmgr clean; \ + rm -Rf /etc/tor/*.sample || true; \ rm -Rf "/config" "/data" || true; \ rm -rf /etc/systemd/system/*.wants/* || true; \ rm -rf /lib/systemd/system/systemd-update-utmp* || true; \ @@ -251,6 +252,5 @@ VOLUME [ "/config","/data" ] EXPOSE ${SERVICE_PORT} ${ENV_PORTS} -CMD [ "tail", "-f", "/dev/null" ] ENTRYPOINT [ "tini","--","/usr/local/bin/entrypoint.sh" ] HEALTHCHECK --start-period=10m --interval=5m --timeout=15s CMD [ "/usr/local/bin/entrypoint.sh", "healthcheck" ] diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index a359209..e76a035 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -12,8 +12,8 @@ # @@Description : Entrypoint file for tor # @@Changelog : New script # @@TODO : Better documentation -# @@Other : -# @@Resource : +# @@Other : +# @@Resource : # @@Terminal App : no # @@sudo/root : no # @@Template : other/docker-entrypoint @@ -73,23 +73,23 @@ unset set_env RUNAS_USER="root" # normally root # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # User and group in which the service switches to - IE: nginx,apache,mysql,postgres -SERVICE_USER="tor" # execute command as another user -SERVICE_GROUP="tor" # Set the service group +SERVICE_USER="" # execute command as another user +SERVICE_GROUP="" # Set the service group # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set user and group ID SERVICE_UID="0" # set the user id SERVICE_GID="0" # set the group id # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Primary server port- will be added to server ports -WEB_SERVER_PORT="" # port : 80,443 +WEB_SERVER_PORT="$PORT" # port : 80,443 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Secondary ports SERVER_PORTS="" # specifiy other ports # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Healthcheck variables -HEALTH_ENABLED="yes" # enable healthcheck [yes/no] -SERVICES_LIST="tini" # comma seperated list of processes for the healthcheck -HEALTH_ENDPOINTS="" # url endpoints: [http://localhost/health,http://localhost/test] +HEALTH_ENABLED="yes" # enable healthcheck [yes/no] +SERVICES_LIST="tini,php,tor" # comma seperated list of processes for the healthcheck +HEALTH_ENDPOINTS="http://127.0.0.1/health/txt" # url endpoints: [http://localhost/health,http://localhost/test] # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Update path var export PATH RUNAS_USER SERVICE_USER SERVICE_GROUP SERVICE_UID SERVICE_GID WWW_ROOT_DIR DATABASE_DIR diff --git a/rootfs/usr/local/etc/docker/init.d/php.sh b/rootfs/usr/local/etc/docker/init.d/php.sh index 5ae8d74..6d8585d 100755 --- a/rootfs/usr/local/etc/docker/init.d/php.sh +++ b/rootfs/usr/local/etc/docker/init.d/php.sh @@ -177,7 +177,15 @@ __run_precopy() { # Define actions/commands if [ ! -d "$WWW_ROOT_DIR" ] || __is_dir_empty "$WWW_ROOT_DIR"; then mkdir -p "$WWW_ROOT_DIR" - cp -Rfv "/usr/local/share/template-files/data/htdocs/www"/* "$WWW_ROOT_DIR/" + cp -Rfv "/usr/share/httpd/default"/* "$WWW_ROOT_DIR/" + fi + if [ -d "$WWW_ROOT_DIR/.git" ]; then + rm -Rf "$WWW_ROOT_DIR/.git" + fi + if [ ! -d "$WWW_ROOT_DIR/health" ]; then + mkdir -p "$WWW_ROOT_DIR/health" + echo "200" >"$WWW_ROOT_DIR/health/txt" + echo '{"message":"ok"}' >"$WWW_ROOT_DIR/health/json" fi # allow custom functions if builtin type -t __run_precopy_local | grep -q 'function'; then __run_precopy_local; fi diff --git a/rootfs/usr/local/etc/docker/init.d/tor.sh b/rootfs/usr/local/etc/docker/init.d/tor.sh index db5c730..5009c08 100755 --- a/rootfs/usr/local/etc/docker/init.d/tor.sh +++ b/rootfs/usr/local/etc/docker/init.d/tor.sh @@ -175,7 +175,7 @@ __run_precopy() { # Define environment local hostname=${HOSTNAME} # Define actions/commands - + [ -f "/etc/tor/torrc.sample" ] && rm -Rf "/etc/tor"/*.sample # allow custom functions if builtin type -t __run_precopy_local | grep -q 'function'; then __run_precopy_local; fi }