Skip to content

Commit

Permalink
docs: dockerise dev
Browse files Browse the repository at this point in the history
Setting up Ruby v2.7 is getting increasingly difficult on newer systems.

This PR aims to help with that by providing a simple way to launch a documentation dev environment.
  • Loading branch information
alxndrsn committed Jan 8, 2025
1 parent bbff7f9 commit 7248b35
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**

!/package.json
!/bin/build-site.js
!/bin/install-jekyll.sh
!/package-lock.json
!/docs/Gemfile
!/docs/Gemfile.lock
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Now you can build the site and start the dev server with:

You should now find the documentation at http://127.0.0.1:4000

You can also build and run the documentation with docker:

$ npm run dev-site-with-docker

Writing a PouchDB Blog Post
--------------------------------------

Expand Down
33 changes: 33 additions & 0 deletions docs-dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# maintain similarity to CI by using common base image:
FROM ubuntu:20.04

RUN apt-get update && \
apt-get --yes install \
build-essential \
curl \
ruby-full \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# TODO confirm ruby version is 2.7... if it matters
RUN gem install bundler -v 2.1.4

ENV NODE_VERSION=22.12.0
ENV NVM_DIR=/root/.nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
RUN . "$NVM_DIR/nvm.sh" && nvm install 22
ENV PATH="$NVM_DIR/versions/node/v${NODE_VERSION}/bin/:${PATH}"

WORKDIR /pouchdb-docs

COPY package.json package-lock.json .
COPY ./bin/ ./bin/

COPY ./docs/Gemfile* ./docs/
RUN npm run install-jekyll
RUN rm -rf ./docs

RUN npm install --ci

CMD ["npm", "run", "build-site"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test": "./bin/run-test.sh",
"prepublishOnly": "npm run build",
"release": "./bin/release.sh",
"dev-site-with-docker": "docker build --file docs-dev.Dockerfile --progress=plain . && docker run -it --rm --volume $PWD/docs:/pouchdb-docs/docs -p 4000:4000 $(docker build --quiet .)",
"install-jekyll": "./bin/install-jekyll.sh",
"publish-site": "./bin/publish-site.sh",
"build-site": "node ./bin/build-site.js",
Expand Down

0 comments on commit 7248b35

Please sign in to comment.