diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c5e8aa32 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +_site/ +.sass-cache/ +.jekyll-metadata +.git/ +.idea/ +*.iml +.DS_Store +vendor/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3f0a3843 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ruby:3.2-slim + +# Install build dependencies required by native gem extensions (e.g., nokogiri) +# and libcurl for htmlproofer link checking +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + git \ + libcurl4-openssl-dev \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /site + +# Install gems first (layer caching - only re-runs when Gemfile changes) +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +# Copy the rest of the site +COPY . . + +EXPOSE 4000 diff --git a/README.md b/README.md index e26d2eca..18ce5c5a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,40 @@ an open source course management, assignment submission, exam, and grading syste To report issues for this repository, please file them under the [Submitty/Submitty](https://github.com/Submitty/Submitty) repository. -## Local Development +## Local Development with Docker (Recommended) + +If you have [Docker](https://www.docker.com/) installed, you do not need to install Ruby or Bundler locally. + +### Setup + +1. Clone the repository: + ```bash + git clone https://github.com/Submitty/submitty.github.io.git + cd submitty.github.io + ``` +2. Start the development container: + ```bash + docker compose up + ``` + The first run will take a few minutes to install dependencies. + +3. Visit [http://localhost:4000](http://localhost:4000) to view the site. + Changes to files will automatically trigger a rebuild and refresh your + browser. + +4. To stop the development container, press `Ctrl+C` or run: + ```bash + docker compose down + ``` +### Running the link checker + +```bash +docker compose exec site bundle exec jekyll build +docker compose exec site bundle exec htmlproofer ./_site --assume-extension --empty-alt-ignore --disable_external +``` +Alternatively, you can develop the site with Ruby and Bundler installed locally. See the instructions below for more information. + +## Local Development with Ruby ### Prerequisites @@ -22,7 +55,7 @@ for example, this would be accomplished by doing `sudo apt-get install ruby-dev` ### Setup -1. Clone the respository on your local machine, e.g., +1. Clone the repository on your local machine, e.g., ``` git clone https://github.com/Submitty/submitty.github.io.git @@ -129,11 +162,11 @@ above structure. Currently, the site only supports three levels of nesting (sub- ## Forked from [Edition](https://github.com/CloudCannon/edition-jekyll-template) This repository was created via a fork of Edition, which is a product documentation theme for Jekyll created -by by [CloudCannon](http://cloudcannon.com/), the Cloud CMS for Jekyll. +by [CloudCannon](http://cloudcannon.com/), the Cloud CMS for Jekyll. ### Ruby Version Troubleshooting In February 2024: -* https://ritviknag.com/tech-tips/ruby-versioning-hell-with-jekyll-&-github-pages/ \ No newline at end of file +* https://ritviknag.com/tech-tips/ruby-versioning-hell-with-jekyll-&-github-pages/ diff --git a/_config_docker.yml b/_config_docker.yml new file mode 100644 index 00000000..8822b612 --- /dev/null +++ b/_config_docker.yml @@ -0,0 +1 @@ +url: "http://localhost:4000" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..837ad008 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + site: + build: . + ports: + - "4000:4000" + - "35729:35729" + volumes: + - .:/site + - bundle_cache:/usr/local/bundle + environment: + - JEKYLL_ENV=docker + command: bundle exec jekyll serve --host 0.0.0.0 --livereload --force_polling --config _config.yml,_config_docker.yml + +volumes: + bundle_cache: