Skip to content

Commit

Permalink
added Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
nadade committed Oct 14, 2016
1 parent 2661655 commit 4980620
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 16 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
@@ -0,0 +1,13 @@
FROM apiaryio/jekyll
MAINTAINER Apiary SRE Team <sre@apiary.io>

ENV REFRESHED_AT 2016-10-14

ADD ./Gemfile /srv/jekyll/Gemfile
ADD ./Gemfile.lock /srv/jekyll/Gemfile.lock

WORKDIR /srv/jekyll
RUN chown -R jekyll /srv/jekyll
RUN bundle
USER jekyll
ENV LC_ALL C.UTF-8
3 changes: 0 additions & 3 deletions Gemfile.lock
Expand Up @@ -77,6 +77,3 @@ DEPENDENCIES
jekyll-sitemap
rake
rouge

BUNDLED WITH
1.12.5
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -19,12 +19,12 @@

## Running server using Docker

If you don't want to set up Ruby ecosystem, you can preview all posts using Docker
If you don't want to set up Ruby ecosystem, you can preview all posts using Docker:

```bash
$ docker run --rm --label=jekyll --volume=$(pwd):/srv/jekyll \
-it -p 127.0.0.1:4000:4000 jekyll/jekyll:pages
```
- run `./docker/build.sh` to build the `apiaryio/blog` image
- run `./docker/serve.sh`

The docker image only needs to be rebuilt if the dependencies change.

## Installing Dependencies

Expand Down
30 changes: 22 additions & 8 deletions circle.yml
@@ -1,16 +1,30 @@
machine:
ruby:
version: 2.3.1
test:
services:
- docker

dependencies:
cache_directories:
- "~/docker"

override:
- sudo apt-get update
- sudo apt-get install libcurl3-dev
- bundle exec rake test
- docker info; mkdir -p ~/docker
- if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi
- ./docker/build.sh
- docker save apiaryio/blog > ~/docker/image.tar

deployment:
production:
branch: master
commands:
- git config --global user.name "Apiary Bot"
- git config --global user.email "support@apiary.io"
- git remote set-url origin "https://${GH_TOKEN}@github.com/apiaryio/apiaryio.github.com"
- rake deploy
- git remote set-url origin "https://${GH_TOKEN}@github.com/apiaryio/blog"
- docker run -e GH_TOKEN=$GH_TOKEN --volume=$(pwd):/srv/jekyll apiaryio/blog bash /srv/jekyll/deploy.sh
test:
override:
- ./docker/run-tests.sh

general:
branches:
ignore:
- gh-pages
5 changes: 5 additions & 0 deletions deploy.sh
@@ -0,0 +1,5 @@
#!/bin/bash
git config --global user.name "Apiary Bot"
git config --global user.email "support@apiary.io"
git remote set-url origin "https://${GH_TOKEN}@github.com/apiaryio/apiaryio.github.com"
bundle exec rake deploy
2 changes: 2 additions & 0 deletions docker/build.sh
@@ -0,0 +1,2 @@
#!/bin/bash
docker build -t apiaryio/blog .
2 changes: 2 additions & 0 deletions docker/run-tests.sh
@@ -0,0 +1,2 @@
#!/bin/bash
docker run --volume=$(pwd):/srv/jekyll apiaryio/blog bundle exec rake test
5 changes: 5 additions & 0 deletions docker/serve.sh
@@ -0,0 +1,5 @@
#!/bin/bash

docker run --rm --volume=$(pwd):/srv/jekyll \
-it -p 4000:4000 apiaryio/blog \
jekyll serve -H 0.0.0.0 --watch --drafts --trace --force_polling

0 comments on commit 4980620

Please sign in to comment.