frontend: Include chbase.sh in entrypoint
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7fc860edec
commit
e0dd5ea789
@ -19,7 +19,10 @@ EXPOSE 8080
|
||||
|
||||
WORKDIR /srv
|
||||
|
||||
ENTRYPOINT ["/srv/frontend", "--bind=:8080"]
|
||||
ENTRYPOINT ["/usr/sbin/entrypoint.sh"]
|
||||
CMD ["--bind=:8080"]
|
||||
|
||||
COPY entrypoint-frontend.sh /usr/sbin/entrypoint.sh
|
||||
|
||||
VOLUME /srv/htdocs-frontend/
|
||||
|
||||
|
26
entrypoint-frontend.sh
Executable file
26
entrypoint-frontend.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
CURRENT_BASE="/"
|
||||
[ -n "${BASEURL}" ] || BASEURL="/"
|
||||
|
||||
run() {
|
||||
local NEWBASE=$1
|
||||
local FILE=$2
|
||||
|
||||
if [ -d "${FILE}" ]
|
||||
then
|
||||
for f in "${FILE}/"*.html "${FILE}/"*.js
|
||||
do
|
||||
run "${NEWBASE}" "${f}"
|
||||
done
|
||||
[ -d "${FILE}/js/" ] && run "${NEWBASE}" "${FILE}/js"
|
||||
[ -d "${FILE}/views/" ] && run "${NEWBASE}" "${FILE}/views"
|
||||
elif [ -f "${FILE}" ]
|
||||
then
|
||||
sed -ri "s@(href|src)=\"${CURRENT_BASE}@\1=\"${NEWBASE}@g;s@\\\$http.get\(\"${CURRENT_BASE}@\$http.get\(\"${NEWBASE}@g;s@\\\$http\((.*)\"${CURRENT_BASE}@\$http(\1\"${NEWBASE}@g" ${FILE}
|
||||
fi
|
||||
}
|
||||
|
||||
[ "${CURRENT_BASE}" != "${BASEURL}"] && run "${BASEURL}" /srv/htdocs-frontend
|
||||
|
||||
exec /srv/frontend $@
|
Loading…
Reference in New Issue
Block a user