Skip to content

Commit f97819c

Browse files
committed
dockerfile and build instructions
add docker registry reference
1 parent d5072c8 commit f97819c

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

website/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:11.15.0
2+
3+
WORKDIR /spacy-io
4+
5+
RUN npm install -g gatsby-cli@2.7.4
6+
7+
COPY package.json .
8+
COPY package-lock.json .
9+
10+
RUN npm install
11+
12+
# This is so the installed node_modules will be up one directory
13+
# from where a user mounts files, so that they don't accidentally mount
14+
# their own node_modules from a different build
15+
# https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders
16+
WORKDIR /spacy-io/website/

website/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,40 @@ extensions for your code editor. The
554554
[`.prettierrc`](https://github.com/explosion/spaCy/tree/master/website/.prettierrc)
555555
file in the root defines the settings used in this codebase.
556556
557+
## Building & Developing the Site with Docker {#docker}
558+
Sometimes it's hard to get a local environment working due to rapid updates to node dependencies,
559+
so it may be easier to use docker for building the docs.
560+
561+
If you'd like to do this,
562+
**be sure you do *not* include your local `node_modules` folder**,
563+
since there are some dependencies that need to be built for the image system.
564+
Rename it before using.
565+
566+
```bash
567+
docker run -it \
568+
-v $(pwd):/spacy-io/website \
569+
-p 8000:8000 \
570+
ghcr.io/explosion/spacy-io \
571+
gatsby develop -H 0.0.0.0
572+
```
573+
574+
This will allow you to access the built website at http://0.0.0.0:8000/
575+
in your browser, and still edit code in your editor while having the site
576+
reflect those changes.
577+
578+
**Note**: On M1 Macs you may need to the image tagged `arm64` (`ghcr.io/explosion/spacy-io:arm64`),
579+
otherwise you'll see `qemu` segfault during the build.
580+
581+
### Building the Docker Image {#docker-build}
582+
583+
If you'd like to build the image locally, you can do so like this:
584+
585+
```bash
586+
docker build -t spacy-io .
587+
```
588+
589+
This will take some time, so if you want to use the prebuilt image you'll save a bit of time.
590+
557591
## Markdown reference {#markdown}
558592
559593
All page content and page meta lives in the `.md` files in the `/docs`

0 commit comments

Comments
 (0)