Skip to content

Commit

Permalink
using docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sujaykundu777 committed Feb 11, 2020
1 parent e402ab1 commit b4d9502
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 42 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM jekyll/jekyll:latest as build

WORKDIR /srv/jekyll

ADD . /srv/jekyll

RUN gem install bundler && \
rm -rf Gemfile.lock && \
chmod -R 777 ${PWD} && \
bundle update && \
bundle install
# jekyll build && \
# jekyll serve --livereload --drafts --trace

ARG build_command
ENV BUILD_COMMAND ${build_command}

CMD ${BUILD_COMMAND}

# EXPOSE 4000
19 changes: 5 additions & 14 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ gem 'rack-jekyll'
gem 'rake'
gem 'puma'


# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# Plugins
group :jekyll_plugins do
gem 'devlopr', '~> 0.4.5'
Expand All @@ -20,20 +25,6 @@ group :jekyll_plugins do
gem 'jekyll-menus', '~> 0.6.1'
end

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
# group :jekyll_plugins do
# gem "jekyll-feed", "~> 0.13.0"
# gem "jekyll-paginate", "~> 1.1.0"
# gem "jekyll-gist", "~> 1.5.0"
# gem "jekyll-seo-tag", "~> 2.6.1"
# gem "jekyll-sitemap", "~> 1.4.0"
# # gem "jekyll-algolia"
# end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,34 @@

- Image Gallery Support

## Using Docker :

Building the Image :

`docker build -t my-devlopr-jekyll-blog .`

Running the container :

`docker run -d -p 4000:4000 -it --volume="$PWD:/srv/jekyll" --name "my_blog" my-devlopr-jekyll-blog:latest jekyll serve --watch`

## Using Docker Compose :

### Development :

You can run the app in development mode : (your changes will be reflected --watch moded)

Serve the site at http://localhost:4000 :

`docker-compose -f docker-compose-dev.yml up --build --remove-orphans`

### Production :

You can run the app in production mode : (your changes will be reflected --watch moded)

Serve the site at http://localhost:4000 :

`docker-compose -f docker-compose-prod.yml up --build --remove-orphans`

## Contributions:

Contributions are more than just welcome. Fork this repo and create a new branch, then submit a pull request
Expand Down
22 changes: 11 additions & 11 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,28 @@
integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous"> -->


<link rel="stylesheet" href="{{site.url}}{{site.baseurl}}/assets/css/main.css" />
<link rel="stylesheet" href="{{site.url}}{{site.baseurl}}/assets/css/custom-style.css" />
<link rel="stylesheet" href="{{site.url}}/assets/bower_components/lightgallery/dist/css/lightgallery.min.css"/>
<link rel="stylesheet" href="/assets/css/main.css" />
<link rel="stylesheet" href="/assets/css/custom-style.css" />
<link rel="stylesheet" href="/assets/bower_components/lightgallery/dist/css/lightgallery.min.css"/>
<link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.0.0-beta.3/default/snipcart.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch-theme-algolia.min.css">
<link rel="stylesheet" href="{{site.url}}/assets/bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="{{site.url}}/assets/bower_components/font-awesome/web-fonts-with-css/css/fontawesome-all.min.css" />
<link rel="stylesheet" href="/assets/bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="/assets/bower_components/font-awesome/web-fonts-with-css/css/fontawesome-all.min.css" />
<!-- Fonts-->
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">

<!-- Favicon -->
<link rel="icon" href="{{site.url}}{{site.baseurl}}/assets/img/favicon.ico" type="image/gif" sizes="16x16">

<!-- Jquery -->
<script src="{{site.url}}/assets/bower_components/jquery/dist/jquery.min.js"></script>
<script src="{{site.url}}/assets/bower_components/jquery.easing/jquery.easing.min.js"></script>
<script src="{{site.url}}/assets/bower_components/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="{{site.url}}/assets/bower_components/jquery-mousewheel/jquery.mousewheel.min.js"></script>
<script src="{{site.url}}/assets/bower_components/lightgallery/dist/js/lightgallery-all.min.js"></script>
<script src="/assets/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/assets/bower_components/jquery.easing/jquery.easing.min.js"></script>
<script src="/assets/bower_components/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="/assets/bower_components/jquery-mousewheel/jquery.mousewheel.min.js"></script>
<script src="/assets/bower_components/lightgallery/dist/js/lightgallery-all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/picturefill/3.0.2/picturefill.min.js"></script>
<script src="{{site.url}}/assets/bower_components/imagesloaded/imagesloaded.pkgd.min.js"></script>
<script src="/assets/bower_components/imagesloaded/imagesloaded.pkgd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>

Expand Down
4 changes: 2 additions & 2 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div class="col-lg-12">
<div class="row">
<div class="col-md-2 center">
<a href="{{site.url}}{{site.baseurl}}/">
<img src="{{site.url}}{{site.baseurl}}/assets/img/{{ site.author_logo }}" class="profile-img">
<a href="/">
<img src="/assets/img/{{ site.author_logo }}" class="profile-img">
</a>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ We need this token as a Environment Variable in Travis. For Travis can automatic

Go to [Github Generate a New Token](https://github.com/settings/tokens) Page.

![deploy using travis](/devlopr-jekyll/assets/img/posts/d1.png){:class="img-fluid"}
![deploy using travis](/assets/img/posts/d1.png){:class="img-fluid"}

Create a new Access Token

![deploy using travis](/devlopr-jekyll/assets/img/posts/d2.png){:class="img-fluid"}
![deploy using travis](/assets/img/posts/d2.png){:class="img-fluid"}


##### Configure Travis

Go to [Travis](https://travis.org) and Toggle the repository access to use Travis

![deploy using travis](/devlopr-jekyll/assets/img/posts/d3.png){:class="img-fluid"}
![deploy using travis](/assets/img/posts/d3.png){:class="img-fluid"}

Go to the repository settings page and Add Environment Variable 'GITHUB_TOKEN'
![deploy using travis](/devlopr-jekyll/assets/img/posts/d4.png){:class="img-fluid"}
![deploy using travis](/assets/img/posts/d4.png){:class="img-fluid"}

##### Push your changes to Github

Expand All @@ -89,10 +89,10 @@ Commit your local changes in gh-pages branch

After push, Travis will automatically run a build process and deploy your blog.

![deploy using travis](/devlopr-jekyll/assets/img/posts/d5.png){:class="img-fluid"}
![deploy using travis](/assets/img/posts/d5.png){:class="img-fluid"}

You can visit your site at https://yourusername.github.io

![deploy using travis](/devlopr-jekyll/assets/img/posts/d6.png){:class="img-fluid"}
![deploy using travis](/assets/img/posts/d6.png){:class="img-fluid"}

Done ! Enjoy your brand new devlopr-jekyll blog. You can visit the site at https://yourusername.github.io
16 changes: 8 additions & 8 deletions _posts/2019-05-22-using-siteleaf.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ Note : If you have not created your blog yet. Create Your Blog , then comeback l

Login to [Siteleaf](https://www.siteleaf.com/)

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/1.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/1.png){:class="img-fluid"}

Select Connect with Github, connect existing repository:

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/2.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/2.png){:class="img-fluid"}

Select the repository of your devlopr-jekyll blog:

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/3.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/3.png){:class="img-fluid"}

Connect and Create Site:

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/4.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/4.png){:class="img-fluid"}

After successful import, You will be redirected to manage dashboard :

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/5.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/5.png){:class="img-fluid"}

But before making any changes to our blog, we need to change our current Siteleaf membership plan to Free Plan (For Developers)

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/6.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/6.png){:class="img-fluid"}

Select Free Plan :

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/8.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/8.png){:class="img-fluid"}

Congrats ! Your New Admin Panel for your devlopr-jekyll blog is ready to make any changes to your blog :D

![Using Siteleaf ](/devlopr-jekyll/assets/img/posts/siteleaf/9.png){:class="img-fluid"}
![Using Siteleaf ](/assets/img/posts/siteleaf/9.png){:class="img-fluid"}



Expand Down
25 changes: 25 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3' # specify docker-compose version

# Define the services/containers to be run
services:
jekyllbuild:
build:
context: .
args:
build_command: "jekyll build --watch"
volumes:
- ".:/srv/jekyll"
ports:
- 4000:4000
- 35729:35729
nginx:
image: nginx
volumes:
- "./build:/var/www/public"
- "./nginx/nginx.conf:/etc/nginx/nginx.conf"
- "./nginx/html/404.html:/usr/share/nginx/html/404.html"
# to use jekyll's 404 page, uncomment the line below and disable the line above
# Important: ensure that 404.html exist else this will throw an error during build
# - "./web/_site/404.html:/usr/share/nginx/html/404.html"
ports:
- 80:80
22 changes: 22 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3' # specify docker-compose version

# Define the services/containers to be run
services:
jekyllbuild:
build:
context: .
args:
build_command: "jekyll build"
volumes:
- ".:/srv/jekyll"
nginx:
image: nginx
volumes:
- "./build:/var/www/public"
- "./nginx/nginx.conf:/etc/nginx/nginx.conf"
- "./nginx/html/404.html:/usr/share/nginx/html/404.html"
# to use jekyll's 404 page, uncomment the line below and disable the line above
# Important: ensure that 404.html exist else this will throw an error during build
# - "./web/_site/404.html:/usr/share/nginx/html/404.html"
ports:
- 80:80
2 changes: 1 addition & 1 deletion install.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Get Started
layout: page
permalink: /get-started
permalink: /get-started/
---

## Getting Started - How to create your blog using devlopr-jekyll
Expand Down
2 changes: 2 additions & 0 deletions nginx/html/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1 style='color:red'>Error 404: Not found</h1>
<p>I have no idea where that file is.</p>
49 changes: 49 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;


server {
listen 80;
index index.html;
server_name localhost;
root /var/www/public;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log error;

location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; }


error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}

}
}

0 comments on commit b4d9502

Please sign in to comment.