Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Move docker setup into docs #647

Merged
merged 1 commit into from
May 7, 2022
Merged
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
8 changes: 0 additions & 8 deletions Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions docker-compose.yml

This file was deleted.

9 changes: 9 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ruby:2.7
EXPOSE 4000

COPY . /docs
WORKDIR /docs

RUN bundle install

CMD bundle exec jekyll serve --watch -H 0.0.0.0 -P 4000
19 changes: 9 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Overview

- For background, including which branch to work on, see ["Updating documentation" in CONTRIBUTING](../CONTRIBUTING.md#updating-documentation)
- The documentation is written in Markdown
- It is converted to HTML via Ruby and Jekyll
- Important: Ruby 2 is required, for example, Ruby 2.7
- The published documentation is at <https://schemar.github.io/obsidian-tasks/>
- For background, including which branch to work on, see ["Updating documentation" in CONTRIBUTING](../CONTRIBUTING.md#updating-documentation)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered where these extra spaces were coming from.
There's a curious cycle going on that your edits include extra spaces in bullet lists, and then @sytone (and I think mine) remove them.

It's is only cosmetic, but it does make git annotate/blame rather less useful, and makes reviews take longer, as you have to mentally separate out formatting changes from content ones...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's my LSP based md formatter 🤔

- The documentation is written in Markdown
- It is converted to HTML via Ruby and Jekyll
- Important: Ruby 2 is required, for example, Ruby 2.7
- The published documentation is at <https://schemar.github.io/obsidian-tasks/>

## Test documentation locally with Jekyll

Expand Down Expand Up @@ -50,9 +50,8 @@ If you can run docker, this is the easiest way.
Now every time you want to see the docs locally, run:

```bash
cd obsidian-tasks/
docker-compose up
# (not docker compose up)
cd obsidian-tasks/docs
./docker_start
```

You will eventually see output ending something like this:
Expand All @@ -76,14 +75,14 @@ This runs a web server inside Docker that you can view on your own machine.
Look for the line containing `Server address:` and open that URL in your local browser.
It will be something like <http://0.0.0.0:4000/obsidian-tasks/>.

You can stop the service by running `docker-compose down` or by hitting Ctrl+C.
You can stop the service by hitting `Ctrl+c`.

## Option 2: Running without Docker

### Prerequisites for using installed Jekyll

1. Install ruby 2.x.
* It is important that you use a version 2 of ruby, not version 3, for example 2.7.0.
- It is important that you use a version 2 of ruby, not version 3, for example 2.7.0.
1. Run:
```bash
cd obsidian-tasks/
Expand Down
27 changes: 27 additions & 0 deletions docs/docker_start
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -exuo pipefail

TAG="obsidian-tasks-docs:latest"

message () {
printf "\n#\n#\n# %s\n#\n#\n" "$1"
}

# Check if a built image exists.
# If not, we need to build it first.
if [[ "$(docker images -q $TAG 2>/dev/null)" == "" ]]; then
message "First time starting the server."
message "We need to build the image first ..."
docker build --tag $TAG .
fi

message "Stop the server with Ctrl-c"

# Actually run the jekyll server.
# Volume with :Z is required for linux users due to SELinux.
docker run --rm \
-it \
--volume "$PWD:/docs:Z" \
--publish 4000:4000 \
"localhost/${TAG}"