Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker version of Hydejack #230

Closed
ajaysjournal opened this issue Aug 23, 2020 · 2 comments
Closed

Docker version of Hydejack #230

ajaysjournal opened this issue Aug 23, 2020 · 2 comments

Comments

@ajaysjournal
Copy link

ajaysjournal commented Aug 23, 2020

The latest/pro version requires ruby 2.7 or above(correct me if I am wrong), for some reasons I dont want to upgrade ruby version, which might break other ruby projects.
It would be great and easy, if we have docker version of Hyde jack. Just added a my version of Docker file below.

FROM ruby:2.7
RUN gem install bundler -v "~>1.0" && gem install bundler jekyll

RUN ruby -v

EXPOSE 4000

WORKDIR /home/user/
RUN mkdir website
WORKDIR /home/user/website
COPY hydejack-pro-9.0.3/starter-kit .

RUN ls
RUN git init
ENV JEKYLL_ENV=production
RUN bundle install
CMD [ "bundle", "exec", "jekyll", "serve", "--force_polling", "-H", "0.0.0.0", "-P", "4000", "--trace"]

How to run it ?

docker build --tag hydejack:9 .
docker run -p 4000:4000 hydejack:9

Issue

Fetching gem metadata from https://rubygems.org/.........
Fetching https://github.com/benbalter/jekyll-default-layout
Fetching https://github.com/hydecorp/jekyll-include-cache
Fetching https://github.com/hydecorp/jekyll-seo-tag
jekyll-theme-hydejack-9.0.3 requires ruby version ~> 2.6, which is incompatible with the current version, ruby 2.5.1p57
Could not find execjs-2.7.0 in any of the sources
Run `bundle install` to install missing gems.
@qwtel
Copy link
Member

qwtel commented Aug 25, 2020

I've used the Jekyll Docker images before: https://github.com/envygeeks/jekyll-docker

Based on your error message Could not find execjs-2.7.0 in any of the sources it looks like kramdown-math-katex is the problem though. Have you tried removing it from the Gemfile? More on math support here: https://hydejack.com/docs/config/#enabling-math-blocks

@ajaysjournal
Copy link
Author

@qwtel - Thanks, I will try your suggestion. Already started using docker-compose, and just don't want to fix on current system.
Couple of times I faced env issue, I suggest this feature. Now the app is running on docker, also mounted the local volume to docker, so that it will dynamically builds the site when host files changed. Everything looks perfect in docker world :)

Docker file

execute touch Dockerfile and add below contents to it.

FROM ajaycs14/hydejack-base:latest
EXPOSE 4000
WORKDIR /code
COPY starter-kit .
RUN git init
ENV JEKYLL_ENV=production
RUN bundle install
CMD [ "bundle", "exec", "jekyll", "serve", "--force_polling", "-H", "0.0.0.0", "-P", "4000", "--watch"]

Docker Compose file

execute touch docker-compose.yml and add below contents to it.

version: '2.4'

services:
  blog:
    build: .
    volumes:
      - ./starter-kit:/code
    ports:
      - '24230:4000'

How to run

  1. Build the docker-compose using docker-compose build
  2. Run using docker-compose up
  3. Stop using docker-compose down

Troubleshooting

I added this on Gemfile, for some reasons I was not able to find JS runtime container env, some quick google search got fixed it.

gem "kramdown-math-katex" # add beloow 2 lines on gemfile
gem 'execjs'
gem 'therubyracer', :platforms => :ruby

@qwtel qwtel closed this as completed Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants