Skip to content
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ permalink: /en/2016/01/01/short-title

This website is based on [Jekyll](https://jekyllrb.com/). To build
locally, [install Ruby 3.1.2](https://gorails.com/setup) using system
packages, [rvm](https://rvm.io), [rbenv](https://github.com/rbenv/rbenv), or another method.
packages, [rvm](https://rvm.io), [rbenv](https://github.com/rbenv/rbenv), or another method. An
alternative is to use Docker, for which instructions are available [here](./contrib/devtools/).
Then clone this repository and change directory into it:

git clone https://github.com/bitcoin-core/bitcoincore.org.git
Expand Down
29 changes: 29 additions & 0 deletions contrib/devtools/Dockerfile
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
Comment on lines +9 to +15
Copy link
Contributor

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.


WORKDIR /site

COPY . .

RUN gem install bundler \
&& bundle install

RUN make build
Copy link
Contributor

@stickies-v stickies-v Oct 14, 2025

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The 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"]
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're duplicating Makefile commands anyway, I think it might make sense to avoid the make dependency entirely?

Suggested diff that combines all my suggestions:

git diff on 9f7a431
diff --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 make (e.g. also allowing the user to run docker run -it --rm -v "$PWD":/site -p 4000:4000 corewebsite make test, might be useful to add to the readme):

git diff on 9f7a431
diff --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"]

17 changes: 17 additions & 0 deletions contrib/devtools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,20 @@ gribble (18)
| luke-jr | [Luke Dashjr][] |
[...]
```

Dockerfile
==========

Run the website locally without having to install the dependencies on your machine.

To build the image (from the root of the repository):
```
docker build -f ./contrib/devtools/Dockerfile -t corewebsite .
```

Then the container can be run like so:
```
docker run -it --rm -v "$PWD":/site -p 4000:4000 corewebsite
```

And the website can be accessed at https://localhost:4000.