From 9cfa608d5ce0d169677e3a0c33473bfb742583a8 Mon Sep 17 00:00:00 2001 From: Artem Mukhin Date: Sat, 11 Feb 2023 00:20:17 +0100 Subject: [PATCH 1/2] Add Docker deployment --- .dockerignore | 4 +++ .run/intellij-rust.github.io.run.xml | 45 ++++++++++++++++++++++++++++ Dockerfile | 16 ++++++++++ README.md | 20 +++++++++++-- 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 .run/intellij-rust.github.io.run.xml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4581002 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +_posts/ +assets/ +_docs/ +_includes/ diff --git a/.run/intellij-rust.github.io.run.xml b/.run/intellij-rust.github.io.run.xml new file mode 100644 index 0000000..bb94574 --- /dev/null +++ b/.run/intellij-rust.github.io.run.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7b5b3a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ruby:3.2 + +RUN apt-get update && apt-get install -y build-essential + +COPY . /intellij-rust.github.io +WORKDIR /intellij-rust.github.io + +RUN gem install github-pages jekyll jekyll-feed +RUN bundle add webrick +RUN bundle update +RUN bundle install + +EXPOSE 8080 + +WORKDIR /intellij-rust.github.io +CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--port", "8080", "--future"] diff --git a/README.md b/README.md index 540b98f..c1d4bef 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Install [Ruby](https://www.ruby-lang.org) and [Bundler](http://bundler.io/). There is `.ruby-version` file for [rbenv](https://github.com/rbenv/rbenv) if you like. -You will probably need GCC, Make, AutoConf and NodeJS installed. +You will probably need GCC, Make, AutoConf and NodeJS installed. ```bash $ bundle install @@ -15,7 +15,7 @@ $ bundle exec jekyll serve --future If you are using Windows, it's better not to fight with Ruby Installer. I use WSL and works pretty flawlessly, except file change watching (see -[tracking issue](https://github.com/Microsoft/BashOnWindows/issues/216)). So you'll have to run +[tracking issue](https://github.com/Microsoft/BashOnWindows/issues/216)). So you'll have to run this instead: ```bash @@ -28,3 +28,19 @@ To workaround lack of watching, you can do: $ bundle exec jekyll serve --detach $ while (bundle exec jekyll build --incremental); do sleep 5; done ``` + +## Docker + +Run `intellij-rust.github.io` configuration directly from IntelliJ IDEA. The website will be accessible at `http://localhost:8080/`. +Any changes made in `_posts`, `assets`, `_docs`, and `_includes` directories will be reflected immediately. + +Alternatively, you can use the following commands from the terminal: +```bash +$ docker build -t intellij-rust.github.io . +$ docker run \ + -v $PWD/_posts:/intellij-rust.github.io/_posts \ + -v $PWD/assets:/intellij-rust.github.io/assets \ + -v $PWD/_docs:/intellij-rust.github.io/_docs \ + -v $PWD/_includes:/intellij-rust.github.io/_includes \ + -p 8080:8080 -it intellij-rust.github.io +``` From 3075ad9eb06104b1c56e57be896490248c987a6f Mon Sep 17 00:00:00 2001 From: vlad20012 Date: Tue, 14 Mar 2023 11:22:27 +0100 Subject: [PATCH 2/2] Improve Docker deployment Reduce the image size to 1Gb, mount `_site` for better caching, reduce the number of docker image layers --- .dockerignore | 14 ++++++++++---- .run/intellij-rust.github.io.run.xml | 4 ++++ Dockerfile | 5 +---- README.md | 1 + _config.yml | 1 + 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 4581002..7fc633f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,10 @@ -_posts/ -assets/ -_docs/ -_includes/ +/.git/ +/_site/ +/_posts/ +/assets/ +/_docs/ +/_includes/ +/.idea/ +/.run/ +/*.iml +/README.md diff --git a/.run/intellij-rust.github.io.run.xml b/.run/intellij-rust.github.io.run.xml index bb94574..d8405a9 100644 --- a/.run/intellij-rust.github.io.run.xml +++ b/.run/intellij-rust.github.io.run.xml @@ -36,6 +36,10 @@ diff --git a/Dockerfile b/Dockerfile index 7b5b3a1..901f41b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,7 @@ RUN apt-get update && apt-get install -y build-essential COPY . /intellij-rust.github.io WORKDIR /intellij-rust.github.io -RUN gem install github-pages jekyll jekyll-feed -RUN bundle add webrick -RUN bundle update -RUN bundle install +RUN gem install github-pages jekyll jekyll-feed && bundle add webrick && bundle update && bundle install EXPOSE 8080 diff --git a/README.md b/README.md index c1d4bef..5042afb 100644 --- a/README.md +++ b/README.md @@ -42,5 +42,6 @@ $ docker run \ -v $PWD/assets:/intellij-rust.github.io/assets \ -v $PWD/_docs:/intellij-rust.github.io/_docs \ -v $PWD/_includes:/intellij-rust.github.io/_includes \ + -v $PWD/_site:/intellij-rust.github.io/_site \ -p 8080:8080 -it intellij-rust.github.io ``` diff --git a/_config.yml b/_config.yml index 0438a0d..5f57b64 100644 --- a/_config.yml +++ b/_config.yml @@ -9,6 +9,7 @@ title: IntelliJ Rust email: "" description: Open-source Rust plugin for IntelliJ-based IDEs +repository: intellij-rust/intellij-rust.github.io collections: docs: