Skip to content

Commit

Permalink
Fix various
Browse files Browse the repository at this point in the history
  • Loading branch information
smeyfroi committed Mar 10, 2024
1 parent e73aab1 commit 8318ce9
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 40 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM alpine:3.16

RUN apk --no-cache add python3 py3-pip asciidoctor git build-base py3-psutil python3-dev libffi-dev
RUN pip install "Nikola[extras]" python-Levenshtein==0.12.1 pathlib beautifulsoup4 markdown && rm -rf /root/.cache/

WORKDIR /nikola
29 changes: 9 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,21 @@ The `documentation` folder contains the OF API reference and are also in markdow

## Setting up the site to build locally using Docker

* Pre-reqs: a working [Docker](https://www.docker.com/get-started/) environment and *nix shell
* Build a container (alpine linux, python3, nikola) with `./build_docker.sh`
This site is built using [nikola](https://getnikola.com).
There's some scripts in the `bin/` folder that use Docker
to make it easier to install and use.
(Tested on MacOS).

* Pre-reqs: a working [Docker](https://www.docker.com/get-started/)
environment and *nix shell
* Build an image (alpine linux, python3, nikola) with
`./bin/build_docker.sh` (delete the image with `./bin/rm_docker.sh`)
* Build the site and serve it on `http://localhost:8000/` with `./nikola_auto_build.sh`
* (Build the site only with `./nikola_build.sh`)
* (Serve the site on `http://localhost:8000/` with `./nikola_serve.sh`)

## Setting up the site to build locally

This site is built using [nikola](https://getnikola.com). There's some scripts in the root folder to make it easier to install and use.

1. First, if installing on Mac OS-X, make sure the Xcode command lines tools have been installed:

```bash
xcode-select --install
```
and then install the following packages (If you do not have brew installed you can grab it from [brew.sh](http://brew.sh/)):

```bash
brew install python3
sudo easy_install pip
brew linkapps python3
```

2. From the ofSite source directory, run ./install.sh which installs nikola and all the needed dependencies. (This has only been tested on linux and OS-X).

3. Please make sure the symbol link `~/nikola/.Python` to python3 path is correct before you run `install.sh` script.

4. Finally add the following to your .basrc, .bash_profile or .zshrc file:
`export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"`
Expand Down
4 changes: 0 additions & 4 deletions auto_build.sh

This file was deleted.

7 changes: 7 additions & 0 deletions bin/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DOCKER_IMAGE_TAG="ofsite/nikola:1.0"

docker build \
-t "${DOCKER_IMAGE_TAG}" \
"${SCRIPT_DIR}/.."
11 changes: 11 additions & 0 deletions bin/nikola_auto_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DOCKER_IMAGE_TAG="ofsite/nikola:1.0"

docker run \
--rm \
-ti \
-p 127.0.0.1:8000:8000/tcp \
-v "${SCRIPT_DIR}/..:/nikola" \
"${DOCKER_IMAGE_TAG}" \
nikola auto -a 0.0.0.0
11 changes: 11 additions & 0 deletions bin/nikola_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DOCKER_IMAGE_TAG="ofsite/nikola:1.0"

docker run \
--rm \
-ti \
-p 127.0.0.1:8000:8000/tcp \
-v "${SCRIPT_DIR}/..:/nikola" \
"${DOCKER_IMAGE_TAG}" \
nikola build
11 changes: 11 additions & 0 deletions bin/nikola_serve.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DOCKER_IMAGE_TAG="ofsite/nikola:1.0"

docker run \
--rm \
-ti \
-p 127.0.0.1:8000:8000/tcp \
-v "${SCRIPT_DIR}/..:/nikola" \
"${DOCKER_IMAGE_TAG}" \
nikola serve -a 0.0.0.0
6 changes: 6 additions & 0 deletions bin/rm_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DOCKER_IMAGE_TAG="ofsite/nikola:1.0"

docker image rm \
"${DOCKER_IMAGE_TAG}"
11 changes: 11 additions & 0 deletions bin/sh_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DOCKER_IMAGE_TAG="ofsite/nikola:1.0"

docker run \
--rm \
-ti \
-p 127.0.0.1:8000:8000/tcp \
-v "${SCRIPT_DIR}/..:/nikola" \
"${DOCKER_IMAGE_TAG}" \
/bin/ash
4 changes: 0 additions & 4 deletions build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions build_docker.sh

This file was deleted.

2 changes: 0 additions & 2 deletions nikola_auto_build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions nikola_build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions nikola_serve.sh

This file was deleted.

4 changes: 0 additions & 4 deletions serve.sh

This file was deleted.

0 comments on commit 8318ce9

Please sign in to comment.