From 444e8ab9eefaa9458a53d6f53e64e8eb850d802e Mon Sep 17 00:00:00 2001 From: Panos Sakkos Date: Wed, 7 Feb 2024 17:44:18 +0200 Subject: [PATCH] fix running with Docker --- Dockerfile | 8 ++++++++ README.md | 19 ++++--------------- _config.dev.yml | 1 + _config.yml | 2 +- docker-compose.yml | 8 +++----- 5 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..904d716806 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM jekyll/jekyll:latest + +WORKDIR /srv/jekyll +COPY . . +RUN gem install webrick +RUN ./scripts/generate-tags +RUN ./scripts/generate-categories +CMD ["jekyll", "serve", "--watch", "--host", "0.0.0.0", "--config", "_config.yml,_config.dev.yml"] diff --git a/README.md b/README.md index 84863d3b5c..e21e469a20 100644 --- a/README.md +++ b/README.md @@ -68,24 +68,13 @@ Then, you can build and serve your website by simply running: ./scripts/serve-production ``` -To serve across lan (requires su to forward the port 4000 over lan): +### Run using Docker -```shell -./scripts/serve-lan-production -``` - -### Docker - -Run using Docker: - -```shell -docker run --rm -it -p 4000:4000 -v "$PWD:/srv/jekyll" jekyll/jekyll jekyll serve --watch --host "0.0.0.0" --config _config.yml,_config.dev.yml -``` - -Run using Docker with Docker Compose: +Alternatively, you can use Docker to run the website to avoid installing any +dependencies to your local environment. To do so, run: ```shell -docker-compose up +docker-compose up --build ``` ## OSS used in { Personal } diff --git a/_config.dev.yml b/_config.dev.yml index 2b9cde5315..ea11b3c290 100644 --- a/_config.dev.yml +++ b/_config.dev.yml @@ -1 +1,2 @@ +url: "0.0.0.0:4000" baseurl: "" diff --git a/_config.yml b/_config.yml index f648ad630a..9fc0529a94 100644 --- a/_config.yml +++ b/_config.yml @@ -158,6 +158,6 @@ paginate_path: "blog/page:num/" # Enable minification SASS sass: style: compressed -gems: +plugins: - jekyll-paginate - jemoji diff --git a/docker-compose.yml b/docker-compose.yml index 24d02811b1..8baa5ec973 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,7 @@ -version: "3" +version: "3.8" services: jekyll: - image: jekyll/jekyll + build: . + platform: linux/amd64 ports: - "4000:4000" - command: jekyll serve --watch --host "0.0.0.0" --config _config.yml,_config.dev.yml - volumes: - - .:/srv/jekyll