diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..81494e2ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM jekyll/jekyll:4 + +# Set default locale for the environment +ENV LC_ALL C.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +ENTRYPOINT ["/usr/local/bin/bundle", "exec", \ + "jekyll", "serve", \ + "--host", "0.0.0.0", \ + "--port", "4000"] diff --git a/README.md b/README.md index 88543ad9d..b136aca95 100644 --- a/README.md +++ b/README.md @@ -12,28 +12,44 @@ zlib1g-dev ``` We recommend installing gems to a (hidden) directory in your home folder: -```bash -echo '' >> ~/.bashrc -echo '# Install Ruby Gems to ~/.gems' >> ~/.bashrc -echo 'export GEM_HOME="$HOME/.gems"' >> ~/.bashrc -echo 'export PATH="$HOME/.gems/bin:$PATH"' >> ~/.bashrc -echo '' >> ~/.bashrc -source ~/.bashrc +```sh-session +$ echo '' >> ~/.bashrc +$ echo '# Install Ruby Gems to ~/.gems' >> ~/.bashrc +$ echo 'export GEM_HOME="$HOME/.gems"' >> ~/.bashrc +$ echo 'export PATH="$HOME/.gems/bin:$PATH"' >> ~/.bashrc +$ echo '' >> ~/.bashrc +$ source ~/.bashrc ``` Install jekyll and bundler: -```bash -gem install jekyll bundler +```sh-session +$ gem install jekyll bundler ``` Install gems: -```bash -bundle install +```sh-session +$ bundle install ``` Build and serve locally with: -```bash -bundle exec jekyll serve --host 0.0.0.0 +```sh-session +$ bundle exec jekyll serve --host 0.0.0.0 ``` The site should now be available at http://0.0.0.0:4000/ on your local machine, and your local machine's IP address on your network—great for testing on mobile OSes. + +### Alternative: building with Docker + +You'll need Docker installed on your system. + +Build the Docker image: +```sh-session +$ bin/build-container +``` + +Build and serve locally with: +```sh-session +$ bin/serve +``` + +The site should now be available at http://0.0.0.0:4000/ diff --git a/bin/build-container b/bin/build-container new file mode 100755 index 000000000..775f3afdd --- /dev/null +++ b/bin/build-container @@ -0,0 +1,4 @@ +#!/bin/bash + +cd $(git rev-parse --show-toplevel) # work from repo dir +docker build -t io.elementary.releases . diff --git a/bin/serve b/bin/serve new file mode 100755 index 000000000..b4a597f03 --- /dev/null +++ b/bin/serve @@ -0,0 +1,7 @@ +#!/bin/bash + +cd $(git rev-parse --show-toplevel) # work from repo dir +docker run --rm -it \ + -v $(pwd):/srv/jekyll/ \ + -p 4000:4000 \ + io.elementary.releases