Virtual whiteboard for sketching hand-drawn like diagrams
Prepare for Docker publishing (#1771)
Kostas Bariotisf1ceeab8d965
diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.ymlindex 8fc3be23ff..0ee6e2d3d0 100644--- a/.github/workflows/publish-docker.yml+++ b/.github/workflows/publish-docker.yml@@ -15,6 +15,6 @@ jobs:with:username: ${{ secrets.DOCKER_USERNAME }}password: ${{ secrets.DOCKER_PASSWORD }}- repository: getexcalidraw/excalidraw+ repository: excalidraw/excalidrawtag_with_ref: truetag_with_sha: truediff --git a/Dockerfile b/Dockerfileindex 25805cb53e..dc88aff19d 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,16 +1,31 @@-FROM node:14-alpine AS build+FROM node:14-alpine AS deps++ARG REACT_APP_INCLUDE_GTAG=false-WORKDIR /usr/src/app+RUN mkdir /opt/node_app && chown node:node /opt/node_app+WORKDIR /opt/node_app++USER nodeCOPY package.json package-lock.json ./-RUN npm install+RUN npm install --no-optional && npm cache clean --force+ENV PATH /opt/node_app/node_modules/.bin:$PATH+WORKDIR /opt/node_appCOPY . .-ENV NODE_ENV=production++FROM node:14-alpine AS build++ARG NODE_ENV=production+ARG REACT_APP_INCLUDE_GTAG=false++WORKDIR /opt/node_app+COPY --from=deps /opt/node_app .+RUN lsRUN npm run build:appFROM nginx:1.17-alpine-COPY --from=build /usr/src/app/build /usr/share/nginx/html+COPY --from=build /opt/node_app/build /usr/share/nginx/htmlHEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1diff --git a/README.md b/README.mdindex b5948baab6..d2a8816b34 100644--- a/README.md+++ b/README.md@@ -10,6 +10,7 @@<a title="Crowdin" target="_blank" href="https://crowdin.com/project/excalidraw"><img src="https://badges.crowdin.net/excalidraw/localized.svg"></a>+ <img src="https://img.shields.io/docker/pulls/excalidraw/excalidraw.svg"></p></div>@@ -50,10 +51,27 @@ git clone https://github.com/excalidraw/excalidraw.git#### Docker Compose+You can use docker-compose to work on excalidraw locally if you don't want to setup a Node.js env.+```shdocker-compose up --build -d```+## Self hosting++We publish a Docker image with the Excalidraw client at [excalidraw/excalidraw](https://hub.docker.com/r/excalidraw/excalidraw). You can use it to self host your own client under your own domain, on Kubernetes, AWS ECS, etc.++```sh+docker build -t excalidraw/excalidraw .+docker run --rm -dit --name excalidraw -p 5000:80 excalidraw/excalidraw:latest+```++The Docker image is free of analytics and other tracking libraries.++**At the moment, self-hosting your own instance doesn't support sharing or collaboration features.**++We are working towards providing a full-fledged solution for self hosting your own Excalidraw.+## ContributingPull 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.diff --git a/docker-compose.yml b/docker-compose.ymlindex 0bc3f939d3..111776d2dd 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -1,9 +1,27 @@-version: "3"+version: "3.8"services:excalidraw:- build: .+ build:+ context: .+ args:+ - NODE_ENV=development+ target: depscontainer_name: excalidrawports:- - "5000:80"+ - "3000:3000"restart: on-failure+ command: npm run start+ stdin_open: true+ healthcheck:+ disable: true+ environment:+ - NODE_ENV=development+ volumes:+ - ./:/opt/node_app/app:delegated+ - ./package.json:/opt/node_app/package.json+ - ./package-lock.lock:/opt/node_app/package-lock.lock+ - notused:/opt/node_app/app/node_modules++volumes:+ notused:diff --git a/package.json b/package.jsonindex a790106ac3..4d3c106787 100644--- a/package.json+++ b/package.json@@ -74,7 +74,7 @@"scripts": {"build": "npm run build:app && npm run build:zip","build-node": "node ./scripts/build-node.js",- "build:app": "REACT_APP_GIT_SHA=$NOW_GITHUB_COMMIT_SHA react-scripts build",+ "build:app": "REACT_APP_INCLUDE_GTAG=true REACT_APP_GIT_SHA=$NOW_GITHUB_COMMIT_SHA react-scripts build","build:zip": "node ./scripts/build-version.js","eject": "react-scripts eject","fix": "npm run fix:other && npm run fix:code",diff --git a/public/index.html b/public/index.htmlindex d8557e47c8..d32cb5dcd5 100644--- a/public/index.html+++ b/public/index.html@@ -90,6 +90,7 @@style="--pwacompat-splash-font: 24px Virgil;"/>+ <% if (process.env.REACT_APP_INCLUDE_GTAG === 'true') { %><scriptasyncsrc="https://www.googletagmanager.com/gtag/js?id=UA-387204-13"@@ -102,6 +103,7 @@gtag("js", new Date());gtag("config", "UA-387204-13");</script>+ <% } %></head><body>