#5 add build and preview script
Opened 4 years ago by jibecfed. Modified 2 years ago
fedora-docs/ jibecfed/pages master  into  master

file added
+3
@@ -0,0 +1,3 @@ 

+ build

+ public

+ cache

file added
+9
@@ -0,0 +1,9 @@ 

+ FROM fedora:29

+ 

+ RUN dnf -y module install nodejs:10 && \

+     dnf clean all

+ 

+ RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0

+ 

+ WORKDIR /antora

+ ENTRYPOINT [ "antora" ]

file added
+46
@@ -0,0 +1,46 @@ 

+ #!/bin/sh

+ 

+ image="docker.io/antora/antora"

+ cmd="--html-url-extension-style=indexify site.yml"

+ 

+ if [ "$(uname)" == "Darwin" ]; then

+     # Running on macOS.

+     # Let's assume that the user has the Docker CE installed

+     # which doesn't require a root password.

+     echo ""

+     echo "This build script is using Docker container runtime to run the build in an isolated environment."

+     echo ""

+     docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora $image $cmd

+ 

+ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then

+     # Running on Linux.

+     # Check whether podman is available, else faill back to docker

+     # which requires root.

+ 

+     if [ -f /usr/bin/podman ]; then

+         echo ""

+         echo "This build script is using Podman to run the build in an isolated environment."

+         echo ""

+ 	podman run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z $image $cmd

+ 

+     elif [ -f /usr/bin/docker ]; then

+         echo ""

+         echo "This build script is using Docker to run the build in an isolated environment."

+         echo ""

+ 

+         if groups | grep -wq "docker"; then

+ 	    docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z $image $cmd

+ 	else

+             echo ""

+             echo "This build script is using $runtime to run the build in an isolated environment. You might be asked for your password."

+             echo "You can avoid this by adding your user to the 'docker' group, but be aware of the security implications. See https://docs.docker.com/install/linux/linux-postinstall/."

+             echo ""

+             sudo docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z $image $cmd

+ 	fi

+     else

+         echo ""

+ 	echo "Error: Container runtime haven't been found on your system. Fix it by:"

+ 	echo "$ sudo dnf install podman"

+ 	exit 1

+     fi

+ fi

@@ -19,4 +19,6 @@ 

  

  * xref:ask-fedora-sops:ROOT:index.adoc[**Ask Fedora SOPs**] - Standard operating procedures for the link:https://ask.fedoraproject.org/[Ask Fedora forums].

  

- * xref:localization:ROOT:index.adoc[**Fedora Docs Localization Stats**] - Statistics about this site's localization.

+ * xref:localization:ROOT:index.adoc[**Fedora Localization Project**] - The Fedora Localization Project.

+ 

+ * xref:docs-l10n:ROOT:index.adoc[**Fedora Docs Localization Stats**] - Statistics about the Fedora documentation localization progress.

file added
+14
@@ -0,0 +1,14 @@ 

+ server {

+     listen       80;

+     server_name  localhost;

+ 

+     location / {

+         root   /antora/public;

+         index  index.html index.htm;

+     }

+ 

+     error_page   500 502 503 504  /50x.html;

+     location = /50x.html {

+         root   /usr/share/nginx/html;

+     }

+ }

file added
+19
@@ -0,0 +1,19 @@ 

+ #!/bin/sh

+ 

+ 

+ if [ "$(uname)" == "Darwin" ]; then

+     # Running on macOS.

+     # Let's assume that the user has the Docker CE installed

+     # which doesn't require a root password.

+     echo "The preview will be available at http://localhost:8080/"

+     docker run --rm -v $(pwd):/antora:ro -v $(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf:ro -p 8080:80 nginx

+ 

+ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then

+     # Running on Linux.

+     # Fedora Workstation has python3 installed as a default, so using that

+     echo ""

+     echo "The preview is available at http://localhost:8080"

+     echo ""

+     cd ./public

+     python3 -m http.server 8080

+ fi

file added
+24
@@ -0,0 +1,24 @@ 

+ site:

+   title: Local Preview - Documentation Guide

+   start_page: documentation-guide::index

+ content:

+   sources:

+   - url: .

+     start_path: homepage

+   - url: .

+     start_path: engineering

+   - url: .

+     start_path: mindshare

+ ui:

+   bundle:

+     url: https://asamalik.fedorapeople.org/ui-bundle.zip

+     snapshot: true

+   default_layout: with_menu

+ output:

+   clean: true

+   dir: ./public

+   destinations:

+   - provider: archive

+ runtime:

+   pull: true

+   cache_dir: ./cache

I wanted to change the homepage to use asciidoc instead of HTML and realized there is no build.sh or preview.sh, here is the fix

rebased onto a0a8007

4 years ago

@pbokoc kind reminder, is there some changes required?