Giter Club home page Giter Club logo

jekyll-docker's Introduction

jekyll-docker

Jekyllを使用できるDockerイメージを作成します。

GitHub release license Docker Automated build u6k.blog()

Requirement

  • Docker
$ docker version
Client:
 Version:      1.12.0
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   8eab29e
 Built:        Thu Jul 28 23:54:00 2016
 OS/Arch:      windows/amd64

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 23:26:11 2016
 OS/Arch:      linux/amd64
  • Amazon Web ServicesのIAMユーザー、およびアクセスキー
    • Amazon S3にWebサイトをアップロードする場合

Usage

Jekyllサイトを管理するフォルダで、以下のようにjekyll-dockerコンテナを起動します。新規にサイトを作成する場合は、空のフォルダで起動します。

$ docker run --rm -it -v $(pwd):/var/myblog -p 4000:4000 u6kapps/jekyll-docker bash

新規のJekyllサイトを作成する場合

# jekyll new .

カレント・フォルダにファイルが生成されます。

Jekyllサイトをプレビューする場合

# bundle update
# jekyll server --host 0.0.0.0

http://localhost:4000にアクセスすると、プレビューが表示されます。

JekyllサイトをAmazon S3にアップロードする場合

s3_website.ymlを作成して、設定を行います。

# s3_website cfg create

s3_website.ymlの、以下の項目を設定します。

s3_id: <%= ENV['AWS_ACCESS_KEY'] %>
s3_secret: <%= ENV['AWS_SECRET_KEY'] %>
s3_bucket: [バケット名]
s3_endpoint: ap-northeast-1

NOTE: s3_ids3_secretは機密情報なので、s3_website.ymlに直接書くのではなく、環境変数から読み取るようにしています。なので、このs3_website.ymlはgitリポジトリに格納してしまっても良いです。

Bucketが未作成の場合、Bucketを作成します。

# s3_website cfg apply

Webサイトをビルドして、Amazon S3にアップロードします。

# bundle update
# jekyll build
# s3_website push

(中略)

[info] Successfully pushed the website to http://blog.u6k.me.s3-website-ap-northeast-1.amazonaws.com

最後に表示されたURLにアクセスすると、アップロードしたWebサイトが表示されます。

Author

License

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.