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

Need relative path

parent bf7e5594
Branches
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
INDEX_HTML="" INDEX_HTML=""
OVERRIDES_MAIN_HTML=""
SCRIPTS_EXTRA_JS=""
function generate_docs { function generate_docs {
BRANCH="release-$1" BRANCH="release-$1"
...@@ -14,6 +16,12 @@ function generate_docs { ...@@ -14,6 +16,12 @@ function generate_docs {
find .docs/ -type f -exec sed -i -e "s/__CHARTVERSION__/$1/g" {} \; find .docs/ -type f -exec sed -i -e "s/__CHARTVERSION__/$1/g" {} \;
if [ "$1" = "latest" ]; then if [ "$1" = "latest" ]; then
INDEX_HTML=$(cat .docs/redirect.html) 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 fi
mkdocs build > /dev/null && cp -r ./site "./final/$1" mkdocs build > /dev/null && cp -r ./site "./final/$1"
cp -r "./swagger/$1" "./final/$1/swagger" cp -r "./swagger/$1" "./final/$1/swagger"
...@@ -43,11 +51,16 @@ if [ -z "$APP_VERSION" ]; then ...@@ -43,11 +51,16 @@ if [ -z "$APP_VERSION" ]; then
echo "Variable APP_VERSION not set" echo "Variable APP_VERSION not set"
exit 2 exit 2
fi fi
echo "==================================================="
echo "APP_VERSION=$APP_VERSION" echo "APP_VERSION=$APP_VERSION"
echo "==================================================="
# ensure branches exist on machine # ensure branches exist on machine
git fetch git fetch
generate_api "latest"
generate_docs "latest"
# versions # versions
for i in "${!versions[@]}"; do for i in "${!versions[@]}"; do
version="${versions[i]}" version="${versions[i]}"
...@@ -55,10 +68,11 @@ for i in "${!versions[@]}"; do ...@@ -55,10 +68,11 @@ for i in "${!versions[@]}"; do
generate_docs "$version" generate_docs "$version"
done done
# finalization # finalization
echo "===================================================" echo "==================================================="
echo "Adding index.html from branch master" echo "Adding index.html from branch release-latest"
echo $INDEX_HTML > .docs/redirect.html echo $INDEX_HTML > .docs/redirect.html
sed -i -e "s/__APPVERSION__/${APP_VERSION}/g" .docs/redirect.html sed -i -e "s/__APPVERSION__/${APP_VERSION}/g" .docs/redirect.html
cp ./.docs/redirect.html ./final/index.html cp ./.docs/redirect.html ./final/index.html
echo "===================================================" echo "==================================================="
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Redirect Notice</title> <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> </head>
<body> <body>
<h1>Redirect Notice</h1> <h1>Redirect Notice</h1>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
available at: available at:
</p> </p>
<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> </p>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -2,11 +2,11 @@ FROM python:3.11-slim as build ...@@ -2,11 +2,11 @@ FROM python:3.11-slim as build
WORKDIR /app 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 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 .git/ .git/
COPY .docs/ .docs/ COPY .docs/ .docs/
COPY ./requirements.txt ./requirements.txt COPY ./requirements.txt ./requirements.txt
...@@ -18,9 +18,3 @@ FROM nginx as runtime ...@@ -18,9 +18,3 @@ FROM nginx as runtime
WORKDIR /usr/share/nginx/html/infrastructures/dbrepo/ WORKDIR /usr/share/nginx/html/infrastructures/dbrepo/
COPY --from=build /app/final /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