diff --git a/website/Dockerfile b/website/Dockerfile new file mode 100644 index 000000000..747b1f344 --- /dev/null +++ b/website/Dockerfile @@ -0,0 +1,16 @@ +FROM node:11.15.0 + +WORKDIR /thinc-io + +RUN npm install -g gatsby-cli@2.7.4 + +COPY package.json . +COPY package-lock.json . + +RUN npm install + +# This is so the installed node_modules will be up one directory +# from where a user mounts files, so that they don't accidentally mount +# their own node_modules from a different build +# https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders +WORKDIR /thinc-io/website/ diff --git a/website/README.md b/website/README.md index 8c8d53a98..1e3b10ce5 100644 --- a/website/README.md +++ b/website/README.md @@ -14,6 +14,30 @@ npm run dev # start dev server A `.prettierrc` is included in the repo, so if you set up auto-formatting with Prettier, it should match the style. +## Build and run the website in a Docker container + +Rather than installing NPM locally, you can also build a Docker container with +the prerequisite dependencies: + +```bash +docker build -t thinc-io . +``` + +Afterwards, the website can be built and run in the container: + +```bash +docker run --rm -it \ + -v $PWD:/thinc-io/website \ + -p 8000:8000 \ + thinc-io \ + gatsby develop -H 0.0.0.0 +``` + +This is currently the only way to build the website on ARM64 Macs, since the +required Node.js version is not built for macOS/ARM64. + +These commands also work with Podman by replacing `docker` by `podman`. + ## Directory structure - `/docs`: Docs pages as Markdown.