Skip to content

Instantly share code, notes, and snippets.

@tenekev
Last active April 6, 2024 10:47
Show Gist options
  • Save tenekev/0e96895ff1789d7ce82aeec287487640 to your computer and use it in GitHub Desktop.
Save tenekev/0e96895ff1789d7ce82aeec287487640 to your computer and use it in GitHub Desktop.
Setting up Excalidraw with a Collaboration server
DOMAIN_NAME=yourdomain.tld
TZ=Europe/London
version: "3.7"
# https://github.com/excalidraw/excalidraw/issues/6506
volumes:
notused:
driver: local
services:
excalidraw-server:
container_name: excalidraw
image: custom_excalidraw:latest
restart: always
environment:
NODE_ENV: production
TZ: ${TZ}
PUB_SRV_NAME: draw.${DOMAIN_NAME}
PUB_SRV_NAME_WS: draw-ws.${DOMAIN_NAME}
REACT_APP_BACKEND_V2_GET_URL: https://draw.${DOMAIN_NAME}/api/v2/
REACT_APP_BACKEND_V2_POST_URL: https://draw.${DOMAIN_NAME}/api/v2/post
REACT_APP_WS_SERVER_URL: https://draw-ws.${DOMAIN_NAME}/
volumes:
- notused:/opt/node_app/app/node_modules
excalidraw-room:
container_name: excaliroom
image: excalidraw/excalidraw-room:latest
restart: always
environment:
TZ: ${TZ}
PORT: 3002
FROM node:14-alpine AS download
WORKDIR /opt/node_app
RUN wget https://github.com/excalidraw/excalidraw/archive/refs/tags/v0.17.3.tar.gz -O excalidraw.tar.gz
RUN tar -zvxf excalidraw.tar.gz
RUN mv excalidraw-* excalidraw
FROM node:14-alpine AS build
ENV PUB_SRV_NAME draw.$DOMAIN_NAME
ENV PUB_SRV_NAME_WS draw-ws.$DOMAIN_NAME
ENV NODE_ENV development
ENV TZ $TZ
ENV REACT_APP_BACKEND_V2_GET_URL https://$PUB_SRV_NAME/api/v2/
ENV REACT_APP_BACKEND_V2_POST_URL https://$PUB_SRV_NAME/api/v2/post
ENV REACT_APP_WS_SERVER_URL https://$PUB_SRV_NAME_WS/
WORKDIR /opt/node_app
COPY --from=download /opt/node_app/excalidraw/package.json /opt/node_app/excalidraw/yarn.lock ./
RUN yarn --ignore-optional --network-timeout 600000
COPY --from=download /opt/node_app/excalidraw/ .
RUN yarn build:app:docker
FROM nginx:1.21-alpine
COPY --from=build /opt/node_app/build /usr/share/nginx/html
HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment