mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
chore: Add entrypoint.sh script for web UI Docker container + check log files only in /var/log/bunkerweb
This commit is contained in:
parent
80ac2f50a0
commit
6354d770e9
3 changed files with 28 additions and 9 deletions
|
|
@ -49,6 +49,7 @@ WORKDIR /usr/share/bunkerweb
|
|||
|
||||
COPY src/ui/src ui/src
|
||||
COPY src/ui/*.py ui/
|
||||
COPY --chmod=750 src/ui/entrypoint.sh ui/
|
||||
|
||||
FROM python:3.12.4-alpine@sha256:7f15e22f496c65cffbbac5e30e7e98d60f3e3b9cc5ee5d51cf3c55ed604787c8
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ RUN umask 027
|
|||
# Install runtime dependencies and add ui user
|
||||
RUN apk add --no-cache bash unzip libmagic mariadb-connector-c mariadb-client postgresql-client sqlite && \
|
||||
addgroup -g 101 ui && \
|
||||
adduser -h /var/cache/nginx -g ui -s /bin/sh -G ui -D -H -u 101 ui
|
||||
adduser -h /var/cache/nginx -g ui -s /bin/bash -G ui -D -H -u 101 ui
|
||||
|
||||
# Fix CVEs
|
||||
RUN apk add --no-cache "busybox>=1.36.1-r17" "busybox-binsh>=1.36.1-r17" "ssl_client>=1.36.1-r17" # CVE-2023-42363 CVE-2023-42364 CVE-2023-42365 CVE-2023-42366
|
||||
|
|
@ -100,4 +101,4 @@ HEALTHCHECK --interval=10s --timeout=10s --start-period=30s --retries=6 CMD /usr
|
|||
|
||||
ENV PYTHONPATH="/usr/share/bunkerweb/deps/python"
|
||||
|
||||
CMD [ "python3", "-m", "gunicorn", "--config", "gunicorn.conf.py", "--user", "ui", "--group", "ui", "--bind", "0.0.0.0:7000" ]
|
||||
ENTRYPOINT [ "./entrypoint.sh" ]
|
||||
|
|
|
|||
25
src/ui/entrypoint.sh
Normal file
25
src/ui/entrypoint.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
. /usr/share/bunkerweb/helpers/utils.sh
|
||||
|
||||
log "ENTRYPOINT" "ℹ️" "Starting the web UI v$(cat /usr/share/bunkerweb/VERSION) ..."
|
||||
|
||||
# setup and check /data folder
|
||||
/usr/share/bunkerweb/helpers/data.sh "ENTRYPOINT"
|
||||
|
||||
if [[ $(echo "$SWARM_MODE" | awk '{print tolower($0)}') == "yes" ]] ; then
|
||||
echo "Swarm" > /usr/share/bunkerweb/INTEGRATION
|
||||
elif [[ $(echo "$KUBERNETES_MODE" | awk '{print tolower($0)}') == "yes" ]] ; then
|
||||
echo "Kubernetes" > /usr/share/bunkerweb/INTEGRATION
|
||||
elif [[ $(echo "$AUTOCONF_MODE" | awk '{print tolower($0)}') == "yes" ]] ; then
|
||||
echo "Autoconf" > /usr/share/bunkerweb/INTEGRATION
|
||||
else
|
||||
echo "Docker" > /usr/share/bunkerweb/INTEGRATION
|
||||
fi
|
||||
|
||||
python3 -m gunicorn --config gunicorn.conf.py --user ui --group ui --bind 0.0.0.0:7000
|
||||
|
||||
log "ENTRYPOINT" "ℹ️" "Web UI stopped"
|
||||
exit 0
|
||||
|
|
@ -2126,7 +2126,6 @@ def cache():
|
|||
@login_required
|
||||
def logs():
|
||||
logs_path = Path(sep, "var", "log", "bunkerweb")
|
||||
syslog_path = Path(sep, "var", "log", "syslog")
|
||||
|
||||
files = []
|
||||
if logs_path.is_dir():
|
||||
|
|
@ -2134,12 +2133,6 @@ def logs():
|
|||
if file.is_file():
|
||||
files.append(file.name)
|
||||
|
||||
if not files and syslog_path.is_dir():
|
||||
for file in syslog_path.glob("*.log"):
|
||||
if file.is_file():
|
||||
files.append(file.name)
|
||||
logs_path = syslog_path
|
||||
|
||||
current_file = secure_filename(request.args.get("file", ""))
|
||||
|
||||
if current_file and current_file not in files:
|
||||
|
|
|
|||
Loading…
Reference in a new issue