Replacing Travis CI with Docker

Since my paid Travis CI subscription has expired and I don’t intend to renew it, I wanted to see if I could use Docker containers to build and deploy my blog instead. It turns out to be an easy exercise, and I can even reuse my cibuild script to do exactly the same workflow as I did with Travis CI.

I used the official Jekyll and Ryan’s alpine-surge-bash Docker images. As of writing, Ryan has over 50K+ pulls and it’s actively maintained. And even if the alpine-surge-bash image is no longer supported, I can easily build one from his Dockerfile.

Here’re the steps I took:

$ cd source # my Jekyll blog
$ docker run --rm -it -v `pwd`:/srv/jekyll -p 4000:4000 jekyll/jekyll bundle exec jekyll s --force_polling
$ docker run --rm -it -v `pwd`:/srv/jekyll jekyll/jekyll bundle exec sh /srv/jekyll/script/cibuild
$ docker run -it --rm andthensome/alpine-surge-bash surge token
$ docker run --rm -it -v `pwd`/_site/:/srv -e SURGE_LOGIN=[email] \
    -e SURGE_TOKEN=[token] andthensome/alpine-surge-bash surge -p /srv/

Did you do it differently? Share with me how you did it!

comments powered by Disqus

Related Posts

Downgrading Vagrant with Brew

Using Travis CI to build and deploy sites

Amazon EMR, Apache Spark, and Apache Zeppelin