Skip to content

Commit

Permalink
Add Docker-compose file for windows compatibility (alshedivat#875)
Browse files Browse the repository at this point in the history
This file makes it easier for windows users to use docker. (Closes alshedivat#829)

Previous to this commit, those who used Windows had to install Ubuntu
inside windows (via WSL) and run our commands. Now they can run it by
just typing `docker-compose up`.

> The main problem was that `./bin/dockerhub_run.sh` command was written
with `Bash` in mind and you had to change it a little bit to make it
compatible with windows `Powershell`. We shouldn't have two scripts.
This is why adding a `docker-compose.yml` file is necessary.
  • Loading branch information
pourmand1376 authored and chertianser committed Aug 8, 2024
1 parent 150a106 commit 0376cc1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ For a hands-on walkthrough of al-folio installation, check out [this cool video

You need to take the following steps to get `al-folio` up and running in your local machine:

- First, [install docker](https://docs.docker.com/get-docker/)
- First, install [docker](https://docs.docker.com/get-docker/) and [docker-compose](https://docs.docker.com/compose/install/).
- Then, clone this repository to your machine:

```bash
Expand All @@ -178,12 +178,12 @@ $ cd <your-repo-name>
Finally, run the following command that will pull a pre-built image from DockerHub and will run your website.

```bash
$ ./bin/dockerhub_run.sh
$ docker-compose up
```

Note that when you run it for the first time, it will download a docker image of size 300MB or so.

Now, feel free to customize the theme however you like (don't forget to change the name!). After you are done, you can use the same command (`bin/dockerhub_run.sh`) to render the webpage with all you changes. Also, make sure to commit your final changes.
Now, feel free to customize the theme however you like (don't forget to change the name!). After you are done, you can use the same command (`docker-compose up`) to render the webpage with all you changes. Also, make sure to commit your final changes.

<details><summary>(click to expand) <strong>Build your own docker image (more advanced):</strong></summary>

Expand All @@ -193,18 +193,18 @@ First, download the necessary modules and install them into a docker image calle


```bash
$ ./bin/docker_build_image.sh
$ docker-compose -f docker-local.yml build
```

Run the website!

```bash
$ ./bin/docker_run.sh
$ docker-compose -f docker-local.yml up
```

> To change port number, you can edit `docker_run.sh` file.
> To change port number, you can edit `docker-compose.yml` file.
> If you want to update jekyll, install new ruby packages, etc., all you have to do is build the image again using `docker_build_image.sh`! It will download ruby and jekyll and install all ruby packages again from scratch.
> If you want to update jekyll, install new ruby packages, etc., all you have to do is build the image again! It will download ruby and jekyll and install all ruby packages again from scratch.
</details>

Expand Down
3 changes: 2 additions & 1 deletion bin/docker_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ if [ -f "$FILE" ]; then
fi
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
-it al-folio:latest bundler \
exec jekyll serve --watch --port=8080 --host=0.0.0.0
exec jekyll serve --watch --port=8080 --host=0.0.0.0 \
--verbose --livereload
3 changes: 2 additions & 1 deletion bin/dockerhub_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ if [ -f "$FILE" ]; then
fi
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
-it amirpourmand/al-folio bundler \
exec jekyll serve --watch --port=8080 --host=0.0.0.0
exec jekyll serve --watch --port=8080 --host=0.0.0.0 \
--verbose --livereload
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"
# this file uses prebuilt image in dockerhub
services:
jekyll:
image: amirpourmand/al-folio
command: bash -c "
rm -f Gemfile.lock
&& bundler exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose"
ports:
- 8080:8080
volumes:
- .:/srv/jekyll
12 changes: 12 additions & 0 deletions docker-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"

services:
jekyll_custom:
build: .
command: bash -c "
rm -f Gemfile.lock
&& bundler exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose"
ports:
- 8080:8080
volumes:
- .:/srv/jekyll

0 comments on commit 0376cc1

Please sign in to comment.