From 37390e58e1973b1729c1786bba90a3d8dd738816 Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Thu, 3 Nov 2022 15:40:33 +0100 Subject: [PATCH] Fix the Docker setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I found that our previous Docker setup was not good enough and was failing on some machines. I propose the following changes, based on what has been done on the scala.epfl.ch website. The main “fix” is that we indicate a specific version of Ruby, rouge, and bundler. We also propose a different way to invoke docker-compose up that writes the generated files as a regular user (instead of root). --- Dockerfile | 8 +++++--- README.md | 6 +++++- docker-compose.yml | 10 ++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2fe3d70737..d8908e57d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM ruby:2.6 +FROM ruby:2.6.9 -RUN gem install bundler jekyll +RUN gem install rouge -v3.30.0 +RUN gem install bundler:2.3.10 jekyll WORKDIR /srv/jekyll COPY Gemfile . COPY Gemfile.lock . +RUN echo -n "bundle version: " && bundle --version +RUN chmod u+s /bin/chown RUN bundle install - diff --git a/README.md b/README.md index fe377e9f6b..c0d4cbfe66 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,14 @@ For more details, read on. To build and view site with Docker: - docker-compose up + env UID="$(id -u)" GID="$(id -g)" docker-compose up It will incrementally build and serve site at `http://localhost:4000`. +In case the Dockerfile changed, re-build it with: + + env UID="$(id -u)" GID="$(id -g)" docker-compose up --build + For more details on the Docker option, see [this issue](https://github.com/scala/docs.scala-lang/issues/1286). ## Contributing ## diff --git a/docker-compose.yml b/docker-compose.yml index bfc376a362..98cd0dda02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,11 @@ -version: "2" +version: '2' + services: - scala-lang: + jekyll: + user: "${UID}:${GID}" build: . - command: bundle exec jekyll serve --incremental --host=0.0.0.0 + command: sh -c "chown $UID / && bundle exec jekyll serve --incremental --host=0.0.0.0 " ports: - - 4000:4000 + - '4000:4000' volumes: - .:/srv/jekyll