www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
14
local-jsp-docker/tomcat/Dockerfile
Normal file
14
local-jsp-docker/tomcat/Dockerfile
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
FROM tomcat:9.0.102-jdk11-temurin
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates bash perl rsync \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY tomcat/bootstrap-docbase.sh /usr/local/bin/bootstrap-docbase.sh
|
||||
COPY tomcat/entrypoint.sh /usr/local/bin/local-jsp-entrypoint.sh
|
||||
|
||||
RUN chmod +x /usr/local/bin/bootstrap-docbase.sh /usr/local/bin/local-jsp-entrypoint.sh
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/local-jsp-entrypoint.sh"]
|
||||
48
local-jsp-docker/tomcat/bootstrap-docbase.sh
Normal file
48
local-jsp-docker/tomcat/bootstrap-docbase.sh
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
docbase="${LOCAL_DOCBASE:-/data/docbase/}"
|
||||
workspace_www="/workspace/www"
|
||||
workspace_pkl="/workspace/test_pkl"
|
||||
|
||||
mkdir -p \
|
||||
"${docbase}" \
|
||||
"${docbase}_tmp" \
|
||||
"${docbase}_logs" \
|
||||
"${docbase}admin/csv" \
|
||||
"${docbase}_help/attach" \
|
||||
"${docbase}_help/export" \
|
||||
"${docbase}_help/img"
|
||||
|
||||
link_into_docbase() {
|
||||
local source_path="$1"
|
||||
local target_path="$2"
|
||||
|
||||
rm -rf "$target_path"
|
||||
ln -s "$source_path" "$target_path"
|
||||
}
|
||||
|
||||
if [ -d "${workspace_www}/mailMessage" ]; then
|
||||
link_into_docbase "${workspace_www}/mailMessage" "${docbase}mailMessage"
|
||||
fi
|
||||
|
||||
for subdir in _attach _csv _docs _img _imgMsg csv pics images pdf Templates tmp; do
|
||||
if [ -e "${workspace_www}/${subdir}" ]; then
|
||||
link_into_docbase "${workspace_www}/${subdir}" "${docbase}${subdir}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "${workspace_pkl}" ]; then
|
||||
link_into_docbase "${workspace_pkl}" "${docbase}test_pkl"
|
||||
|
||||
for subdir in 2026 live test_images; do
|
||||
if [ -e "${workspace_pkl}/${subdir}" ]; then
|
||||
link_into_docbase "${workspace_pkl}/${subdir}" "${docbase}${subdir}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Common generic aliases for code that expects a mounted external storage root.
|
||||
for alias_name in storage nas archive pkl RUS; do
|
||||
link_into_docbase "${workspace_pkl}" "${docbase}${alias_name}"
|
||||
done
|
||||
fi
|
||||
47
local-jsp-docker/tomcat/entrypoint.sh
Normal file
47
local-jsp-docker/tomcat/entrypoint.sh
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
export CATALINA_TMPDIR=/usr/local/tomcat/temp
|
||||
|
||||
runtime_root="/usr/local/tomcat/webapps/ROOT"
|
||||
workspace_www="/workspace/www"
|
||||
|
||||
rm -rf "$runtime_root"
|
||||
mkdir -p "$runtime_root"
|
||||
|
||||
shopt -s dotglob nullglob
|
||||
|
||||
for source_path in "$workspace_www"/*; do
|
||||
entry_name="$(basename "$source_path")"
|
||||
if [ "$entry_name" = "WEB-INF" ]; then
|
||||
continue
|
||||
fi
|
||||
ln -s "$source_path" "$runtime_root/$entry_name"
|
||||
done
|
||||
|
||||
mkdir -p "$runtime_root/WEB-INF"
|
||||
cp -a "$workspace_www/WEB-INF/." "$runtime_root/WEB-INF/"
|
||||
|
||||
mkdir -p /usr/local/tomcat/conf/Catalina/localhost
|
||||
cat > /usr/local/tomcat/conf/Catalina/localhost/ROOT.xml <<'EOF'
|
||||
<Context>
|
||||
<Resources allowLinking="true" />
|
||||
</Context>
|
||||
EOF
|
||||
|
||||
/usr/local/bin/bootstrap-docbase.sh
|
||||
|
||||
patch_context_param() {
|
||||
local param_name="$1"
|
||||
local param_value="$2"
|
||||
|
||||
PARAM_NAME="$param_name" PARAM_VALUE="$param_value" perl -0pi -e 's#(<param-name>\Q$ENV{PARAM_NAME}\E</param-name>\s*<param-value>)[^<]*(</param-value>)#$1 . $ENV{PARAM_VALUE} . $2#egs' "$runtime_root/WEB-INF/web.xml"
|
||||
}
|
||||
|
||||
patch_context_param database "//${LOCAL_DB_HOST:-mysql}/${LOCAL_DB_NAME:-pg}"
|
||||
patch_context_param catalog "${LOCAL_DB_NAME:-pg}"
|
||||
patch_context_param user "${LOCAL_DB_USER:-root}"
|
||||
patch_context_param password "${LOCAL_DB_PASSWORD:-root}"
|
||||
patch_context_param instance "${LOCAL_APP_INSTANCE:-local-model}"
|
||||
|
||||
exec catalina.sh run
|
||||
Loading…
Add table
Add a link
Reference in a new issue