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/accumulo-website.git


The following commit(s) were added to refs/heads/main by this push:
     new 37e0d2af Add containerized development environment (#384)
37e0d2af is described below

commit 37e0d2af0c0dc08574400224453fd7c1332b02fd
Author: Daniel Roberts <ddani...@gmail.com>
AuthorDate: Wed Apr 26 12:57:00 2023 -0400

    Add containerized development environment (#384)
    
    Adds a dockerfile for building a containerized development environment
---
 Dockerfile | 34 ++++++++++++++++++++++++++++++++++
 README.md  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..249f779c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,34 @@
+# This Dockerfile builds an ruby environment for jekyll that empowers
+# making updates to the accumulo website without requiring the dev
+# to maintain a local ruby development environment.
+
+FROM ruby:2.7.8-slim-bullseye as base
+
+RUN apt-get update && apt-get 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
+COPY Gemfile.lock ./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 --force-polling -H $HOST -P $PORT
diff --git a/README.md b/README.md
index b064a77a..65e2cf45 100644
--- a/README.md
+++ b/README.md
@@ -108,6 +108,50 @@ HTML styled "just right".
 Jekyll will print a local URL where the site can be viewed (usually,
 [http://0.0.0.0:4000/](http://0.0.0.0:4000/)).
 
+### Testing using Docker environment 
+
+A containerized development environment can be built using the local
+Dockerfile.
+
+
+A containerized development environment can be built using the local
+Dockerfile. You can build it with the following command:
+
+```bash
+docker build -t webdev .
+```
+
+This action will produce a `webdev` 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.
+
+When you run a container using the webdev 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 -d -v "$PWD":/mnt/workdir -p 4000:4000 webdev
+```
+
+While this container is running, you will be able to review the rendered 
website
+in your local browser at [http://127.0.0.1:4000/](http://127.0.0.1:4000/).
+
+
+Shell access can be obtained by overriding the default container command.
+
+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.
+
+```bash
+docker run -v "$PWD":/mnt/workdir -it webdev /bin/bash
+```
+
 ## Publishing
 
 ### Automatic Staging

Reply via email to