Skip to content

Commit 7172df0

Browse files
authored
Add Docker-compose file for windows compatibility (alshedivat#875)
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.
1 parent a552443 commit 7172df0

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ For a hands-on walkthrough of al-folio installation, check out [this cool video
167167

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

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

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

180180
```bash
181-
$ ./bin/dockerhub_run.sh
181+
$ docker-compose up
182182
```
183183

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

186-
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.
186+
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.
187187

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

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

194194

195195
```bash
196-
$ ./bin/docker_build_image.sh
196+
$ docker-compose -f docker-local.yml build
197197
```
198198

199199
Run the website!
200200

201201
```bash
202-
$ ./bin/docker_run.sh
202+
$ docker-compose -f docker-local.yml up
203203
```
204204

205-
> To change port number, you can edit `docker_run.sh` file.
205+
> To change port number, you can edit `docker-compose.yml` file.
206206
207-
> 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.
207+
> 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.
208208
209209
</details>
210210

bin/docker_run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ if [ -f "$FILE" ]; then
44
fi
55
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
66
-it al-folio:latest bundler \
7-
exec jekyll serve --watch --port=8080 --host=0.0.0.0
7+
exec jekyll serve --watch --port=8080 --host=0.0.0.0 \
8+
--verbose --livereload

bin/dockerhub_run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ if [ -f "$FILE" ]; then
44
fi
55
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
66
-it amirpourmand/al-folio bundler \
7-
exec jekyll serve --watch --port=8080 --host=0.0.0.0
7+
exec jekyll serve --watch --port=8080 --host=0.0.0.0 \
8+
--verbose --livereload

docker-compose.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3"
2+
# this file uses prebuilt image in dockerhub
3+
services:
4+
jekyll:
5+
image: amirpourmand/al-folio
6+
command: bash -c "
7+
rm -f Gemfile.lock
8+
&& bundler exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose"
9+
ports:
10+
- 8080:8080
11+
volumes:
12+
- .:/srv/jekyll

docker-local.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: "3"
2+
3+
services:
4+
jekyll_custom:
5+
build: .
6+
command: bash -c "
7+
rm -f Gemfile.lock
8+
&& bundler exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose"
9+
ports:
10+
- 8080:8080
11+
volumes:
12+
- .:/srv/jekyll

0 commit comments

Comments
 (0)