Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Create a bash script to avoid using of Docker #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ Third, stop the container
```sh
docker stop ovh-docs-dev-env
```

## Without Docker

### Prerequesite

- Python 3 installed

### First launch

After cloning this project, you need to initialize your environment
```
./generate-doc.sh init /path/to/ovh-docs
```

The generator checks out the docs-rendering Git project on `src/docs` directory, creates output folder and link to pages directory on your ovh-docs project.
It launches the `pip install` command to install requirements like `Pelican`.
And then, it calls the `entrypoint.sh` script.

### Next launch

```
./generate-doc.sh launch
```

The generator checks `src/docs` exists and calls the `entrypoint.sh` script.
49 changes: 49 additions & 0 deletions generate-doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage : ./generate-doc.sh launch|init [path/to/ovh-docs]"
echo "Caution : you need Python in version 3"
exit 1
fi

export SRC=./src
export WORKDIR=./src/docs

if [ $1 = "launch" ]; then
# Check if workdir exist first
CMDLS=$(ls $WORKDIR; echo $?)

# Launch server command
if [ $CMDLS -eq "1" ]; then
echo "Use init command first"
else
cd $WORKDIR
echo "Launch entrypoint"
../entrypoint.sh
fi
else
if [ -z "$2" ]; then
echo "Need path to ovh-docs"
exit 1
fi
echo "Clone docs rendering repo"
git clone https://github.com/ovh/docs-rendering.git $WORKDIR
echo "Repo cloned"

cd $WORKDIR

export DOCS=$2
echo "Create pages and output folders"
mkdir output
ln -s $DOCS/pages pages


echo "Install requirements"
pip install -r requirements.txt

echo "Change mode to execute"
chmod +x ../entrypoint.sh

echo "Launch entrypoint"
../entrypoint.sh
fi