Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile for building the website #699

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions website/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down