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

Add Dockerized build environment & scripts #31

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
4 changes: 4 additions & 0 deletions bin/build-container
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cd $(git rev-parse --show-toplevel) # work from repo dir
docker build -t io.elementary.releases .
7 changes: 7 additions & 0 deletions bin/serve
Original file line number Diff line number Diff line change
@@ -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