-
Notifications
You must be signed in to change notification settings - Fork 508
contrib: add a Dockerfile to run the website locally #1184
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM ruby:3.1.2 | ||
|
||
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=true | ||
ENV JEKYLL_ENV=production | ||
ENV RUBYOPT="-KU -E utf-8:utf-8" | ||
|
||
RUN apt update \ | ||
&& apt install -y \ | ||
curl \ | ||
jekyll \ | ||
make \ | ||
ruby \ | ||
ruby-html-proofer \ | ||
ruby-jekyll-redirect-from \ | ||
ruby-kramdown-parser-gfm | ||
|
||
WORKDIR /site | ||
|
||
COPY . . | ||
|
||
RUN gem install bundler \ | ||
&& bundle install | ||
|
||
RUN make build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think building the website inside the image is ideal. It makes more sense to me to generate the website at runtime, in incremental mode. Keeps the image small, and the container more functional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah i should remove that, thanks. |
||
|
||
# Default Jekyll port | ||
EXPOSE 4000 | ||
|
||
CMD ["bundle", "exec", "jekyll", "server", "--host", "0.0.0.0", "--future"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're duplicating Suggested diff that combines all my suggestions: git diff on 9f7a431diff --git a/contrib/devtools/Dockerfile b/contrib/devtools/Dockerfile
index f4e3897..9ed076a 100644
--- a/contrib/devtools/Dockerfile
+++ b/contrib/devtools/Dockerfile
@@ -4,26 +4,14 @@ ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=true
ENV JEKYLL_ENV=production
ENV RUBYOPT="-KU -E utf-8:utf-8"
-RUN apt update \
- && apt install -y \
- curl \
- jekyll \
- make \
- ruby \
- ruby-html-proofer \
- ruby-jekyll-redirect-from \
- ruby-kramdown-parser-gfm
-
WORKDIR /site
-COPY . .
+COPY Gemfile* ./
RUN gem install bundler \
&& bundle install
-RUN make build
-
# Default Jekyll port
EXPOSE 4000
-CMD ["bundle", "exec", "jekyll", "server", "--host", "0.0.0.0", "--future"]
+CMD ["bundle", "exec", "jekyll", "serve", "--future", "--drafts", "--unpublished", "--incremental", "--strict_front_matter", "--host", "0.0.0.0"]
Or if we want to keep using git diff on 9f7a431diff --git a/Makefile b/Makefile
index 75b80c2..7e8c096 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ all: build test
preview:
bundle exec jekyll clean
- bundle exec jekyll serve --future --drafts --unpublished --incremental --strict_front_matter
+ bundle exec jekyll serve --future --drafts --unpublished --incremental --strict_front_matter --host 0.0.0.0
build:
bundle exec jekyll clean
diff --git a/contrib/devtools/Dockerfile b/contrib/devtools/Dockerfile
index f4e3897..eb38463 100644
--- a/contrib/devtools/Dockerfile
+++ b/contrib/devtools/Dockerfile
@@ -4,26 +4,19 @@ ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=true
ENV JEKYLL_ENV=production
ENV RUBYOPT="-KU -E utf-8:utf-8"
-RUN apt update \
- && apt install -y \
- curl \
- jekyll \
+RUN apt-get update \
+ && apt-get install -y \
make \
- ruby \
- ruby-html-proofer \
- ruby-jekyll-redirect-from \
- ruby-kramdown-parser-gfm
+ && rm -rf /var/lib/apt/lists/*
WORKDIR /site
-COPY . .
+COPY Gemfile* ./
RUN gem install bundler \
&& bundle install
-RUN make build
-
# Default Jekyll port
EXPOSE 4000
-CMD ["bundle", "exec", "jekyll", "server", "--host", "0.0.0.0", "--future"]
+CMD ["make", "preview"]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make
seems to be the only dependency we actually need here? All the others are duplicates:ruby
is already provided by the base image, and the others are installed by bundle/specified by Gemfile.