This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluo-website.git


The following commit(s) were added to refs/heads/main by this push:
     new 53c07a0  Add development Dockerfile (#229)
53c07a0 is described below

commit 53c07a0dc4adaba686d49a57650f4fc5007b7077
Author: Dom G. <[email protected]>
AuthorDate: Thu May 8 16:11:28 2025 -0400

    Add development Dockerfile (#229)
    
    * Add development dockerfile
    * Add to readme
---
 Dockerfile | 35 +++++++++++++++++++++++++++++++++++
 README.md  | 37 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2efc9e5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,35 @@
+# This Dockerfile builds an ruby environment for jekyll that empowers
+# making updates to the website without requiring the dev
+# to maintain a local ruby development environment.
+
+FROM ruby:3.2.2-slim-bullseye AS base
+
+RUN apt update && apt install -y --no-install-recommends \
+    build-essential \
+    git \
+    curl \
+    && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /mnt/workdir
+
+# Copy over the Gemfiles so that all build dependencies are installed
+# during the docker build. At runtime, these will be available to Jekyll
+# from the mounted directory. But that's not available during the
+# docker build, so we need to copy them in to pre-install the Gems
+
+COPY Gemfile Gemfile.lock ./
+
+# Gems will be installed under GEM_HOME which is set by the ruby image.
+# See https://hub.docker.com/_/ruby for details.
+
+RUN gem update --system \
+  && bundle install \
+  && gem cleanup
+
+ENV HOST=0.0.0.0
+ENV PORT=4000
+
+EXPOSE $PORT
+
+# Configure the default command to build from the mounted repository.
+CMD bundle exec jekyll serve -H $HOST -P $PORT
\ No newline at end of file
diff --git a/README.md b/README.md
index aa4e1e7..48a44f3 100644
--- a/README.md
+++ b/README.md
@@ -72,10 +72,45 @@ Changes pushed to our `main` branch will automatically 
trigger [Jekyll] to
 build our site from that branch and push the result to our `asf-site`
 branch, where they will be served on [our production site][production].
 
+## Testing using Docker environment 
+
+A containerized development environment can be built using the local
+Dockerfile. You can build it with the following command:
+
+```bash
+docker build -t fluo-site-dev .
+```
+
+This action will produce a `fluo-site-dev` image, with all the website's build
+prerequisites preinstalled. When a container is run from this image, it
+will perform a `jekyll serve` command with the polling option enabled,
+so that changes you make locally will be immediately reflected after
+reloading the page in your browser.
+
+When you run a container using the `fluo-site-dev` image, your current working
+directory will be mounted, so that any changes made by the build inside
+the container will be reflected in your local workspace. This is done with
+the `-v` flag. To run the container, execute the following command:
+
+```bash
+docker run -it -v "$PWD":/mnt/workdir -p 4000:4000 fluo-site-dev
+```
+
+While this container is running, you will be able to review the rendered 
website
+in your local browser at the address printed in the shell 
([http://0.0.0.0:4000/](http://0.0.0.0:4000/)).
+
+Appending `/bin/bash` to the end of the docker command above will provide 
shell access. This is useful for adding new 
+gems, or modifying the Gemfile.lock for updating existing dependencies.
+When using shell access, the local directory must be mounted to ensure
+the Gemfile and Gemfile.lock updates are reflected in your local
+environment so you can create a commit and submit a PR.
+
+You may need to manually delete the `_site` or `.jekyll-cache` directories if
+they already exist and are causing issues with the build.
+
 [Jekyll]: https://jekyllrb.com/
 [production]: https://fluo.apache.org
 [ti]: https://github.com/apache/fluo-website/workflows/CI/badge.svg
 [tl]: https://github.com/apache/fluo-website/actions
 [li]: http://img.shields.io/badge/license-ASL-blue.svg
 [ll]: https://github.com/apache/fluo-website/blob/main/LICENSE
-

Reply via email to