feat: add option for self-hosting via Docker (#1503)

This commit is contained in:
Niko Heikkilä 2020-04-29 08:53:07 +03:00 committed by GitHub
parent dd1dfc5950
commit 4369d88898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 8 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
*
!public/
!src/
!.npmrc
!package-lock.json
!package.json
!tsconfig.json

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:14-alpine AS build
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build:app
FROM nginx:1.17-alpine
COPY --from=build /usr/src/app/build /usr/share/nginx/html
HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1

View File

@ -48,6 +48,25 @@ git clone https://github.com/excalidraw/excalidraw.git
| `npm run test:update` | Update test snapshots | | `npm run test:update` | Update test snapshots |
| `npm run test:code` | Test for formatting with Prettier | | `npm run test:code` | Test for formatting with Prettier |
### Docker Installation
A production-ready version for deploying to e.g. Kubernetes or OpenShift can be built using Docker.
#### Docker Compose
```sh
docker-compose up --build -d
```
#### Native Docker
```sh
docker build -t excalidraw/excalidraw .
docker run --rm -dit --name excalidraw -p 5000:80 excalidraw/excalidraw:latest
```
After building the image and running the container, open <http://localhost:5000> to see the application.
## Contributing ## Contributing
Pull requests are welcome. For major changes, please [open an issue](https://github.com/excalidraw/excalidraw/issues/new) first to discuss what you would like to change. Pull requests are welcome. For major changes, please [open an issue](https://github.com/excalidraw/excalidraw/issues/new) first to discuss what you would like to change.

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: "3"
services:
excalidraw:
build: .
container_name: excalidraw
ports:
- "5000:80"
restart: on-failure

View File

@ -31,16 +31,18 @@
"react-dom": "16.13.1", "react-dom": "16.13.1",
"react-scripts": "3.4.1", "react-scripts": "3.4.1",
"roughjs": "4.2.3", "roughjs": "4.2.3",
"socket.io-client": "2.3.0" "socket.io-client": "2.3.0",
}, "node-sass": "4.14.0",
"devDependencies": { "typescript": "3.8.3",
"@testing-library/jest-dom": "5.5.0",
"@testing-library/react": "10.0.3",
"@types/jest": "25.2.1", "@types/jest": "25.2.1",
"@types/nanoid": "2.1.0", "@types/nanoid": "2.1.0",
"@types/react": "16.9.34", "@types/react": "16.9.34",
"@types/react-dom": "16.9.6", "@types/react-dom": "16.9.6",
"@types/socket.io-client": "1.4.32", "@types/socket.io-client": "1.4.32",
"@testing-library/jest-dom": "5.5.0",
"@testing-library/react": "10.0.3"
},
"devDependencies": {
"asar": "3.0.3", "asar": "3.0.3",
"eslint": "6.8.0", "eslint": "6.8.0",
"eslint-config-prettier": "6.11.0", "eslint-config-prettier": "6.11.0",
@ -48,11 +50,9 @@
"husky": "4.2.5", "husky": "4.2.5",
"jest-canvas-mock": "2.2.0", "jest-canvas-mock": "2.2.0",
"lint-staged": "10.1.7", "lint-staged": "10.1.7",
"node-sass": "4.14.0",
"pepjs": "0.5.2", "pepjs": "0.5.2",
"prettier": "2.0.5", "prettier": "2.0.5",
"rewire": "5.0.0", "rewire": "5.0.0"
"typescript": "3.8.3"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=12.0.0"