Skip to content
This repository has been archived by the owner on Aug 28, 2019. It is now read-only.

Running into a Docker container #150

Open
wants to merge 1 commit into
base: master
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
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ruby:2.1

MAINTAINER Maxence POUTORD <[email protected]>

RUN apt-get update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing a dist-upgrade is also recommended


# Install bundle of gems
WORKDIR /tmp
COPY Gemfile /tmp/
RUN bundle install

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a container, I don't believe that /tmp will get wiped since the container never technically shuts down. You should clean up /tmp explicitly once you are done running a bundle install.


# Copy site into
VOLUME /site

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a volume is unnecessary if you are copying files in. The volume is nice from a live reload perspective, but the copy is nicer for hosting options if someone wants to throw the container up on an Azure App Service or something. I'm not against setting up a volume AND copying, but I think this could be handled more gracefully (perhaps 2 dockerfiles?).

WORKDIR /site
COPY . /site

EXPOSE 4000

ENTRYPOINT ["jekyll", "serve"]
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ page_layout: page
titlecase: true

include: [".htaccess"]
exclude: ["lib", "config.rb", "Capfile", "config", "Gemfile", "Gemfile.lock", "README.md", "LICENSE", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules"]
exclude: ["lib", "config.rb", "Capfile", "config", "Gemfile", "Gemfile.lock", "README.md", "LICENSE", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules", "Dockerfile"]
25 changes: 25 additions & 0 deletions theme-setup/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,31 @@ bundle exec jekyll serve

---

## Running into a Docker container

*Replace `username` with your GitHub account.*

1. Build container:

```
docker build -t username/username.github.io --no-cache .
```

2. Run container:

```
docker run --rm -v $PWD:/site -p 4000:4000 username/username.github.io -H 0.0.0.0 --draft
```

3. Retrieve IP adress:

```
docker inspect -f '{{ .NetworkSettings.IPAddress }}' $(docker ps -f ancestor=username/username.github.io -q)
```

4. Visit `http://<retrieveIpAdress>:4000`


## Folder Structure

{% highlight bash %}
Expand Down