From 5b52e4bcd66d36d50265691b46bceb761ed3c6ec Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Thu, 7 Mar 2024 09:02:02 +0000
Subject: [PATCH] Need relative path

---
 .docs/build-website.sh | 18 ++++++++++++++++--
 .docs/redirect.html    |  4 ++--
 Dockerfile             | 12 +++---------
 3 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/.docs/build-website.sh b/.docs/build-website.sh
index 2cba2561f0..2cc64bc69f 100755
--- a/.docs/build-website.sh
+++ b/.docs/build-website.sh
@@ -1,6 +1,8 @@
 #!/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,10 +68,11 @@ 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
-echo "==================================================="
\ No newline at end of file
+echo "==================================================="
diff --git a/.docs/redirect.html b/.docs/redirect.html
index 053a5581bf..a3737a67b6 100644
--- a/.docs/redirect.html
+++ b/.docs/redirect.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
diff --git a/Dockerfile b/Dockerfile
index feb19e3959..a413165b11 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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
-- 
GitLab