Skip to content

Commit

Permalink
feat: add Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
kitian616 committed May 3, 2019
1 parent 40b90e9 commit 45fd0d5
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"editor.tabSize": 2,
"beautify.config": {
"indent_size": 2
},
"files.associations": {
"*.html": "jekyll"
}
}

18 changes: 18 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ruby:2.6

# Set default locale for the environment
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1

WORKDIR /usr/src/app

COPY Gemfile Gemfile.lock jekyll-text-theme.gemspec ./
RUN bundle install

EXPOSE 4000

CMD ["bundle", "exec", "jekyll", "help"]
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
source "https://rubygems.org"

gem "github-pages", group: :jekyll_plugins

gem "tzinfo-data"
gem "wdm", "~> 0.1.0" if Gem.win_platform?
# gem "github-pages", group: :jekyll_plugins
gemspec
2 changes: 0 additions & 2 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
# Only the main Sass file needs front matter (the dashes are enough)
---
@charset "utf-8";


@import

Expand Down
7 changes: 7 additions & 0 deletions docker/docker-compose.build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.5"

services:
jekyll-text-theme_dev:
build:
context: ../
dockerfile: Dockerfile.dev
15 changes: 15 additions & 0 deletions docker/docker-compose.default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.5"

services:
jekyll-text-theme_dev:
image: docker_jekyll-text-theme_dev
environment:
- JEKYLL_ENV
ports:
- 4000:4000
container_name: jekyll-TeXt-theme_default
volumes:
- ..:/usr/src/app
stdin_open: true
tty: true
command: bundle exec jekyll serve -H 0.0.0.0 -t
15 changes: 15 additions & 0 deletions docker/docker-compose.demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.5"

services:
jekyll-text-theme_dev:
image: docker_jekyll-text-theme_dev
environment:
- JEKYLL_ENV
ports:
- 4000:4000
container_name: jekyll-TeXt-theme_demo
volumes:
- ..:/usr/src/app
stdin_open: true
tty: true
command: bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.yml
15 changes: 15 additions & 0 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.5"

services:
jekyll-text-theme_dev:
image: docker_jekyll-text-theme_dev
environment:
- JEKYLL_ENV
ports:
- 4000:4000
container_name: jekyll-TeXt-theme_dev
volumes:
- ..:/usr/src/app
stdin_open: true
tty: true
command: bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.dev.yml
25 changes: 25 additions & 0 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.5"

services:
jekyll-text-theme_build:
image: docker_jekyll-text-theme_dev
environment:
- JEKYLL_ENV
ports:
- 4000:4000
container_name: jekyll-text-theme_build
volumes:
- ..:/usr/src/app
command: bundle exec jekyll build
jekyll-text-theme_web:
image: nginx
ports:
- 80:80
- 443:443
container_name: jekyll-text-theme_web
restart: unless-stopped
volumes:
- ../_site:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- jekyll-text-theme_build
16 changes: 16 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
gzip_vary on;

root /usr/share/nginx/html;

index index.html;

location / {
try_files $uri $uri/ =404;
}
}
4 changes: 2 additions & 2 deletions docs/_config.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ defaults:
## => Plugins
##############################
plugins:
- jekyll-feed
# - jekyll-feed
- jekyll-paginate
- jekyll-sitemap
# - jekyll-sitemap
- jemoji

data_dir: /docs/_data
1 change: 0 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ plugins:
- jekyll-feed
- jekyll-paginate
- jekyll-sitemap
- jekyll-github-metadata
- jemoji

data_dir: /docs/_data
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
"version": "2.2.4",
"description": "A super customizable Jekyll theme for personal site, team site, blog, project, documentation, etc.",
"scripts": {
"build": "bundle exec jekyll build",
"build": "cross-env JEKYLL_ENV=production bundle exec jekyll build",
"serve": "bundle exec jekyll serve -H 0.0.0.0",
"Gemfile.lock": "docker run --rm -v \"$PWD\":/usr/src/app -w /usr/src/app ruby:2.6 bundle install",
"docker-dev:build-image": "docker-compose -f ./docker/docker-compose.build-image.yml build",
"docker-dev:default": "docker-compose -f ./docker/docker-compose.default.yml up",
"docker-dev:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
"docker-dev:demo-dev": "docker-compose -f ./docker/docker-compose.demo.yml up",
"docker-dev:demo-beta": "cross-env JEKYLL_ENV=beta docker-compose -f ./docker/docker-compose.demo.yml up",
"docker-dev:demo-prod": "cross-env JEKYLL_ENV=production docker-compose -f ./docker/docker-compose.demo.yml up",
"docker-prod:build": "cross-env JEKYLL_ENV=production docker-compose -f ./docker/docker-compose.prod.yml build",
"docker-prod:serve": "cross-env JEKYLL_ENV=production docker-compose -f ./docker/docker-compose.prod.yml up",
"default": "bundle exec jekyll serve -H 0.0.0.0 -t",
"dev": "bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.dev.yml",
"demo-dev": "bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.yml",
"demo-beta": "JEKYLL_ENV=beta bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.yml",
"demo-production": "JEKYLL_ENV=production bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.yml",
"demo-beta": "cross-env JEKYLL_ENV=beta bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.yml",
"demo-prod": "cross-env JEKYLL_ENV=production bundle exec jekyll serve -H 0.0.0.0 -t --config ./docs/_config.yml",
"eslint": "eslint \"_includes/**/*.js\"",
"eslint-fix": "eslint \"_includes/**/*.js\" --fix",
"stylelint": "stylelint --syntax scss \"_sass/**/*.scss\"",
Expand All @@ -33,6 +42,7 @@
},
"homepage": "https://github.com/kitian616/jekyll-TeXt-theme",
"devDependencies": {
"cross-env": "^5.2.0",
"eslint": "^5.4.0",
"stylelint": "^9.5.0",
"stylelint-config-recommended-scss": "^3.2.0",
Expand Down

0 comments on commit 45fd0d5

Please sign in to comment.