Skip to content

Commit

Permalink
Update docker entrypoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
white-gecko committed Feb 21, 2023
1 parent 846f4f0 commit 97cddca
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
-

### Changed
-
- Execute `bundle install` in entrypoint
- Run jekyll with `bundle exec`
- Interpret the CMD provided in context of `bundle exec`
- All bundler features can be disabled by setting `NO_BUNDLER` to a non-empty value

### Fixed
-
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN apt-get update && apt-get -y install build-essential && rm -rf /var/lib/apt/

WORKDIR /data

CMD /docker-resources/entrypoint.sh
ENTRYPOINT ["/docker-resources/entrypoint.sh"]
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ The API Documentation is available at [RubyDoc.info](http://www.rubydoc.info/gem

# Installation

**Docker** There is a docker image check out the section [Docker Usage](#docker-usage).

As a prerequisite for *Jekyll RDF* you of course need to install [*Jekyll*](https://jekyllrb.com/).
Please take a look at the installations instructions at https://jekyllrb.com/docs/installation/.

Expand Down Expand Up @@ -675,6 +677,38 @@ http://www.ifi.uio.no/INF3580/simpsons#Maggie
|instance_template_mappings|Target URI as String : filename of the template as String|no default|Maps given URIs to template-files for rendering an individual instance|```instance_template_mappings: "http://www.ifi.uio.no/INF3580/simpsons#Abraham": "abraham.html"```|
|class_template_mappings|Target URI as String : filename of the template as String|no default|Maps given URIs to template-files for rendering all instances of that class|```class_template_mappings: "http://xmlns.com/foaf/0.1/Person": "person.html"```|

# Docker Usage

There is also a [docker/podman image](https://github.com/AKSW/jekyll-rdf/pkgs/container/jekyll-rdf) that has jekyll and jekyll-rdf pre-installed.
You can get it with:

```
docker pull ghcr.io/aksw/jekyll-rdf:latest
```

and run it e.g. with

```
docker run --rm --workdir /page -v $PWD:/page ghcr.io/aksw/jekyll-rdf:latest
```

or customize the jekyll execution with

```
docker run --rm --workdir /page -v $PWD/sources:/page -v $PWD/build/jekyll:/build ghcr.io/aksw/jekyll-rdf:latest jekyll build -d /build
```

The entrypoint of the image executes `bundle install` first an then runs `bundle exec jekyll build` or `bundle exec <your command>`.
To keep the installed packages between runs specify the environment variable `BUNDLE_PATH` to a location that persists between runs, e.g. `-e BUNDLE_PATH=.vendor`.
To disable the whole bundler stuff set `NO_BUNDLER` to a non-empty value, the entrypoint will run your command as it is.

## Docker Variables

| Name | Default | Description |
|-|-|-|
| `BUNDLE_PATH` | *unset* | Set the path where bundler installs the packages. See also the [bundler docs](https://bundler.io/v2.4/man/bundle-config.1.html#LIST-OF-AVAILABLE-KEYS). |
| `NO_BUNDLER` | *unset* | Set to a non-empty value to disable all bundler parts in the entrypoint |

# Development

## Installation from source
Expand Down
13 changes: 9 additions & 4 deletions docker-resources/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/bin/sh

bundle install
if [ $# -eq 0 ]
if [ -z "$NO_BUNDLER" ]
then
bundle install
if [ $# -eq 0 ]
then
jekyll build
bundle exec jekyll build
else
$@
bundle exec $@
fi
else
$@
fi

0 comments on commit 97cddca

Please sign in to comment.