Skip to content

Commit

Permalink
Update Dockerfile (#844)
Browse files Browse the repository at this point in the history
* Update Dockerfile for latest website changes

* Update to Node 16.
* Do not run as root, this also works better with Node privilege-dropping.
* Update README with new run instructions.

* Add .dockerignore to avoid sending large build contexts
  • Loading branch information
danieldk authored Jan 23, 2023
1 parent 2ef308c commit ff0ca36
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
11 changes: 11 additions & 0 deletions website/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Avoid uploading large Docker contexts
.cache/
public/
node_modules
.npm
logs
*.log
npm-debug.log*
www/
_deploy.sh
*.html
18 changes: 8 additions & 10 deletions website/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM node:11.15.0
FROM node:16

WORKDIR /thinc-ai

RUN npm install -g gatsby-cli@2.7.4

COPY package.json .
COPY package-lock.json .

RUN npm install
USER node

# 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-ai/website/
WORKDIR /home/node
COPY --chown=node package.json .
COPY --chown=node package-lock.json .
RUN npm install

WORKDIR /home/node/website/
4 changes: 2 additions & 2 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Afterwards, the website can be built and run in the container:

```bash
docker run --rm -it \
-v $PWD:/thinc-ai/website \
-v $PWD:/home/node/website \
-p 8000:8000 \
thinc-ai \
gatsby develop -H 0.0.0.0
npm run dev -- -H 0.0.0.0
```

This is currently the only way to build the website on ARM64 Macs, since the
Expand Down

0 comments on commit ff0ca36

Please sign in to comment.