Skip to content
Snippets Groups Projects
Verified Commit 5b52e4bc authored by Martin Weise's avatar Martin Weise
Browse files

Need relative path

parent bf7e5594
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
INDEX_HTML=""
OVERRIDES_MAIN_HTML=""
SCRIPTS_EXTRA_JS=""
function generate_docs {
BRANCH="release-$1"
......@@ -14,6 +16,12 @@ function generate_docs {
find .docs/ -type f -exec sed -i -e "s/__CHARTVERSION__/$1/g" {} \;
if [ "$1" = "latest" ]; then
INDEX_HTML=$(cat .docs/redirect.html)
OVERRIDES_MAIN_HTML=$(cat .docs/overrides/main.html)
SCRIPTS_EXTRA_JS=$(cat .docs/scripts/extra.js)
else
echo $OVERRIDES_MAIN_HTML > .docs/overrides/main.html
mkdir -p .docs/scripts
echo $SCRIPTS_EXTRA_JS > .docs/scripts/extra.js
fi
mkdocs build > /dev/null && cp -r ./site "./final/$1"
cp -r "./swagger/$1" "./final/$1/swagger"
......@@ -43,11 +51,16 @@ if [ -z "$APP_VERSION" ]; then
echo "Variable APP_VERSION not set"
exit 2
fi
echo "==================================================="
echo "APP_VERSION=$APP_VERSION"
echo "==================================================="
# ensure branches exist on machine
git fetch
generate_api "latest"
generate_docs "latest"
# versions
for i in "${!versions[@]}"; do
version="${versions[i]}"
......@@ -55,9 +68,10 @@ for i in "${!versions[@]}"; do
generate_docs "$version"
done
# finalization
echo "==================================================="
echo "Adding index.html from branch master"
echo "Adding index.html from branch release-latest"
echo $INDEX_HTML > .docs/redirect.html
sed -i -e "s/__APPVERSION__/${APP_VERSION}/g" .docs/redirect.html
cp ./.docs/redirect.html ./final/index.html
......
......@@ -5,7 +5,7 @@
<head>
<meta charset="UTF-8">
<title>Redirect Notice</title>
<meta http-equiv="Refresh" content="0; url='https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/__APPVERSION__/'" />
<meta http-equiv="Refresh" content="0; url='/infrastructures/dbrepo/__APPVERSION__/'" />
</head>
<body>
<h1>Redirect Notice</h1>
......@@ -14,7 +14,7 @@
available at:
</p>
<p>
<a href="https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/__APPVERSION__/">https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/__APPVERSION__/</a>
<a href="/infrastructures/dbrepo/__APPVERSION__/">/infrastructures/dbrepo/__APPVERSION__/</a>
</p>
</body>
</html>
\ No newline at end of file
......@@ -2,11 +2,11 @@ FROM python:3.11-slim as build
WORKDIR /app
ENV VERSIONS="latest,1.4.1,1.4.0"
ENV APP_VERSION="1.4.1"
RUN apt-get update && apt-get install -y git
ENV VERSIONS="1.4.1,1.4.0,1.3.0"
ENV APP_VERSION="1.4.1"
COPY .git/ .git/
COPY .docs/ .docs/
COPY ./requirements.txt ./requirements.txt
......@@ -18,9 +18,3 @@ FROM nginx as runtime
WORKDIR /usr/share/nginx/html/infrastructures/dbrepo/
COPY --from=build /app/final /usr/share/nginx/html/infrastructures/dbrepo/
RUN rm -f ./index.html
RUN pwd
RUN ls -la
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment