daattali / beautiful-jekyll

✨ Build a beautiful and simple website in literally minutes. Demo at https://beautifuljekyll.com
https://beautifuljekyll.com
MIT License
5.4k stars 16.27k forks source link

Deploy with Docker #302

Closed adrianocanofre closed 6 years ago

adrianocanofre commented 6 years ago

I'm fork this repository and start the beautiful-jekyll with docker, but this error happens:

Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/style.scss':
                    Invalid US-ASCII character "\xE2" on line 5
daattali commented 6 years ago

Sorry I'm not able to support/solve anything related to docker. I personally haven't tried using docker with this theme. You can look through the history of the code commits to see who added the docker code and try tagging them.

On Jan 14, 2018 09:33, "Adriano Canofre" notifications@github.com wrote:

I'm fork this repository and start the beautiful-jekyll with docker, but this error happens:

Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/style.scss': Invalid US-ASCII character "\xE2" on line 5

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daattali/beautiful-jekyll/issues/302, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6IFJ6PA21C6PERqFBNATAhJ0GDv_wwks5tKhBBgaJpZM4RdnM0 .

adrianocanofre commented 6 years ago

Ok, I ran the docker code described in readme, because I'm trying run local server

docker run -p 4000:4000 -v `pwd`:/app mangar/jekyll:1.1 bash -c "bundle install; bundle exec jekyll serve"
jennydaman commented 6 years ago

Dockerfile is gross... I wrote a new one, and it seems to be working.

I have no idea where your error comes from, though you can try to do what I did.

  1. delete Gemfile.lock [1]
  2. replace Dockerfile [2]
FROM jekyll/jekyll
RUN gem install bundler
WORKDIR /srv/jekyll
COPY Gemfile .
RUN bundle install
EXPOSE 4000
CMD [ "/usr/gem/bin/bundle", "exec", "/usr/local/bundle/bin/jekyll", "serve", "--port", "4000", "--host", "0.0.0.0" ]
STOPSIGNAL 2
  1. Build image
docker build -t beautiful-jekyll $PWD
  1. Start container for the first time. [3]
docker run -d -p 4000:4000 --name beautiful-jekyll -v $PWD:/srv/jekyll beautiful-jekyll

later...

  1. Stop the server
docker stop beautiful-jekyll

later...

  1. Start the container again
docker start beautiful-jekyll

Notes

[1] Gemfile.lock has some unwanted configs that was probably inserted when someone bundled the app with mingw on Windows.

[2] Full path to binaries to avoid wrappers that are provided by the base image jekyll/jekyll. This workaround lets us gracefully stop the server with STOPSIGNAL 2 (sends SIGINT to PID 1).

[3] -d detaches the container from your terminal, if you want to give the container control of file descriptor replace -d with -it

daattali commented 6 years ago

@jennydaman that is a much nicer version of a dockerfile. @adrianocanofre can you confirm if this suggested setup works for you too?

adrianocanofre commented 6 years ago

Thank you @jennydaman , the Dockerfile run perfect. @daattali, yes, I build and run the docker and I was able to run a local server.

jennydaman commented 6 years ago

@daattali Do you want a PR for this

daattali commented 6 years ago

@jennydaman yes, please. And update the corresponding section in the README at the same time.

Would deleting the gemfile.lock be required even if it gets cleaned up?

jennydaman commented 6 years ago

bundle install is going to regenerate a cleaner Gemfile.lock. If Gemfile.lock is not deleted, then some extraneous lines will remain. It's not too much of an issue besides that it annoys me. What do you prefer?

daattali commented 6 years ago

If you think there are remnants of a mingw run in that file, then it should be cleaned up.

daattali commented 6 years ago

this was fixed by @jennydaman