mirror of
https://github.com/octoleo/plantuml-server.git
synced 2025-01-02 12:48:48 +00:00
feat: support deep base URLs
This commit is contained in:
parent
6d90304fd7
commit
afd8bbcceb
@ -24,16 +24,16 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
/generate-jetty-start.sh
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
COPY docker-entrypoint.jetty.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
USER jetty
|
||||
|
||||
ENV BASE_URL=ROOT \
|
||||
WEBAPP_PATH=$JETTY_BASE/webapps
|
||||
ENV WEBAPP_PATH=$JETTY_BASE/webapps
|
||||
RUN rm -rf $WEBAPP_PATH && \
|
||||
mkdir -p $WEBAPP_PATH
|
||||
COPY --from=builder /app/target/plantuml.war $WEBAPP_PATH/ROOT.war
|
||||
COPY --from=builder /app/target/plantuml.war /plantuml.war
|
||||
COPY ROOT.jetty.xml $WEBAPP_PATH/ROOT.xml
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
# Openshift https://docs.openshift.com/container-platform/4.9/openshift_images/create-images.html#images-create-guide-openshift_create-images
|
||||
|
@ -17,14 +17,13 @@ RUN apt-get update && \
|
||||
&& \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
COPY docker-entrypoint.tomcat.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENV BASE_URL=ROOT \
|
||||
WEBAPP_PATH=$CATALINA_HOME/webapps
|
||||
ENV WEBAPP_PATH=$CATALINA_HOME/webapps
|
||||
RUN rm -rf $WEBAPP_PATH && \
|
||||
mkdir -p $WEBAPP_PATH
|
||||
COPY --from=builder /app/target/plantuml.war $WEBAPP_PATH/ROOT.war
|
||||
COPY --from=builder /app/target/plantuml.war /plantuml.war
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["catalina.sh", "run"]
|
||||
|
9
ROOT.jetty.xml
Normal file
9
ROOT.jetty.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
|
||||
|
||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Set name="contextPath">
|
||||
<Env name="CONTEXT_PATH" />
|
||||
</Set>
|
||||
<Set name="war">/plantuml.war</Set>
|
||||
</Configure>
|
@ -3,11 +3,8 @@
|
||||
# cspell:enableCompoundWords
|
||||
###########################################################
|
||||
|
||||
# use environment variables
|
||||
if [ "$BASE_URL" != "ROOT" ]; then
|
||||
mkdir -p "$(dirname "$WEBAPP_PATH/$BASE_URL")"
|
||||
mv "$WEBAPP_PATH/ROOT.war" "$WEBAPP_PATH/$BASE_URL.war"
|
||||
fi
|
||||
# ensure context path starts with a slash
|
||||
export CONTEXT_PATH="/${BASE_URL#'/'}"
|
||||
|
||||
# base image entrypoint
|
||||
if [ -x /docker-entrypoint.sh ]; then
|
18
docker-entrypoint.tomcat.sh
Executable file
18
docker-entrypoint.tomcat.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# cspell:words mkdir
|
||||
# cspell:enableCompoundWords
|
||||
###########################################################
|
||||
|
||||
# choose war file name so that context path is correctly set based on BASE_URL,
|
||||
# following the rules from https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming,
|
||||
# specifically remove leading and trailing slashes and replace the remaining ones by hashes.
|
||||
export FILE_NAME="$(echo "$BASE_URL" | sed -e 's:^/::' -e 's:/$::' -e 's:/:#:g')"
|
||||
export FILE_PATH="$WEBAPP_PATH/$FILE_NAME.war"
|
||||
mv /plantuml.war "$FILE_PATH"
|
||||
|
||||
# base image entrypoint
|
||||
if [ -x /docker-entrypoint.sh ]; then
|
||||
/docker-entrypoint.sh "$@"
|
||||
else
|
||||
exec "$@"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user