Add Docker-compose file for windows compatibility (#875)

This file makes it easier for windows users to use docker. (Closes #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.
This commit is contained in:
Amir Pourmand 2022-10-31 18:57:43 +03:30 committed by GitHub
parent a552443256
commit 7172df0877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 9 deletions

View File

@ -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
@ -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>
@ -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>

View File

@ -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

View File

@ -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
docker-compose.yml Normal file
View File

@ -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
docker-local.yml Normal file
View File

@ -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