From a65bad570bb71f82e64d75e75e188505baf6c4bf Mon Sep 17 00:00:00 2001 From: Rui Martins Date: Wed, 9 Aug 2017 09:57:33 +0200 Subject: [PATCH] Add docker-compose.yml file To run the site in docker is now a single command. --- Dockerfile | 3 +-- docker-compose.yml | 11 +++++++++++ index.md | 13 ++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index b1fa52c..0998d0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,5 +22,4 @@ VOLUME /src EXPOSE 4000 WORKDIR /src -ENTRYPOINT ["jekyll"] - +ENTRYPOINT ["jekyll", "serve", "-H", "0.0.0.0"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f372ae6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '2' +services: + server: + build: + context: . + dockerfile: Dockerfile + image: result/latest + ports: + - "4000:4000" + volumes: + - ".:/src" \ No newline at end of file diff --git a/index.md b/index.md index bfa5581..50b29b7 100644 --- a/index.md +++ b/index.md @@ -74,16 +74,11 @@ If you want to shorten this long command, you can put this code in a file such a ## Running the site in Docker You can also use Docker to directly build and run the site on your local machine. Just clone the repo and run the following from your working dir: +``` +docker-compose up -d +``` +The site should now be running at [http://localhost:4000/](http://localhost:4000/). -``` -docker build --no-cache -t mydocs . -``` - -Once the build is complete, you can mount and run the whole site as follows: - -``` -docker run -v "$PWD:/src" -p 4000:4000 mydocs serve -H 0.0.0.0 -``` This is perhaps the easiest way to see how your site would actually look. ## Configure the sidebar