Docker Compose for Jekyll

  Sep 28, 2017      2m      0   
 

Docker Compose for Jekyll: development and production

Docker Compose for Jekyll

Docker is very useful to setup the development environment without taking much effort. In this tutorial, you can see how we apply Docker Compose to quickly configure the development environment for Jekyll.

Docker Compose for Jekyll development:

  • Create docker-compose.yml
    version: '2'
    services:
    jekyll_web:
      command: jekyll serve --force_polling
      image: jekyll/jekyll:latest
      volumes:
        - ./jekyll:/srv/jekyll
      ports:
        - 4000:4000
        - 35729:35729
        - 3000:3000
        -   80:4000
    
  • Create jekyll directory in the same place with docker-compose.yml
  • The directory structure will look similar to this:
    jekyll_web
    |- jekyll
    |- docker-compose.yml
    
  • Put your source code into jekyll directory and start Docker container:
    $ cd /path/to/jekyll_web
    $ docker-compose up
    
  • The Docker container starts successfully, then you can enjoy your site at localhost

I prepare some docker-compose files. You can download:

Docker Compose for Jekyll PRODUCTION:

  • We simply add environment to the Docker compose file. We can build the production site by using the following docker-compose.yml:
    version: '2'
    services:
    jekyll_web:
      command: jekyll build
      image: jekyll/jekyll:latest
      volumes:
        - ./jekyll:/srv/jekyll
      ports:
        - 4000:4000
        - 35729:35729
        - 3000:3000
        -   80:4000
      environment:
        - JEKYLL_ENV:production
    
  • To build it:
    $ cd /path/to/jekyll_web
    $ docker-compose up
    

Just ask me if you have any issues.


More docker-compose files for you:



Khám phá xử lý ảnh - GVGroup




-->