tldraw / tldraw-v1

A tiny little drawing app. This is the original 2021-2022 version, released under MIT.
https://old.tldraw.com
MIT License
61 stars 36 forks source link

[feature] Publish docker image? #96

Closed decentral1se closed 8 months ago

decentral1se commented 1 year ago

Would be great, especially for self-hosting options for tldraw :love_you_gesture:

judicaelandria commented 1 year ago

Hi @decentral1se , we may not add it to v1, but what you can do is fork the repo, and create a docker image from there! or get only the website in the folder apps/www

rothgar commented 1 year ago

Would the apps/www be enough to self host this in a container? I currently use WBO running locally because it has a very easy container but I really like some of the features tldraw has

nickelswitte commented 1 year ago

Hello, I would also be interested in an Docker image! Would be glad if this makes it into the release :)

Ange-Cesari commented 1 year ago

@nickelswitte @rothgar

Hello, I would also be interested in an Docker image! Would be glad if this makes it into the release :)

Hello everyone,

I wrote a dockerfile for self host tldraw.

As you probably already guessed, the multiplayer does not work.

Concerning the bucket s3 part, for complete self hostable, it is totally possible to use minio, which is a bucket s3 self hostable. See my medium article to make it work with outline-wiki : https://link.medium.com/yhtWcqQxNyb

It will obviously be possible to make a dockerfile when dev decide to stop using liveblocks.io, or at least leave the possibility with alternatives using environment variables, same for the s3 bucket, to make the multiplayer working.

regarding the dockerfile, this is the tldraw site and not the example. To run the example you can modify the dockerfile. Warning : it will be heavier since you have to build from the root folder and have yarn for dependencies, this is the problem of mono repo.

Please note : I didn't do PR because I don’t know what the dev plan to do or not, whether they want to integrate or not. If many people want the dockerfile to be integrated I will do a PR.

In order to make it yourself : pre-requesite : docker & git

Step 1 : Go into a directory and git clone tldraw project :

git clone https://github.com/tldraw/tldraw.git

Step 2 : Create a new file named 'dockerfile' at the root of the project you just cloned and paste the following code :

# Written by Ange Cesari
# Use official Node.js based on Alpine
FROM node:16-alpine

# Install Yarn
RUN apk add --no-cache yarn

# Create dir for application
WORKDIR /usr/src/app

# Copy files from apps/www to workdir

COPY apps/www .
# Change workdir to apps/www
WORKDIR /usr/src/app/apps/www

# Install dependencies with yarn
RUN yarn

# Expose application port (5420 for the tldraw/example)
EXPOSE 3000

# Run application in dev mode
CMD ["yarn", "dev"]

Step 3 : Go in the root directory and build your own image

docker build -t tldraw .

Step 4 : (after waiting some time because of the dependencies) run the docker container :

docker run -d -p 3000:3000 --name tldraw-container tldraw

Step 5 : Wait a little bit of time so it starts properly and connect to http://localhost:3000 in your web browser

You should be able to see the tldraw page.

geekyouth commented 10 months ago

https://hub.docker.com/r/geekyouth/tldraw

docker

docker run --name tldraw -p 3000:3000 -d geekyouth/tldraw:2.0.0-alpha.18

OR

docker compose

version: "3.9"

services:
  tldraw:
    image: geekyouth/tldraw:2.0.0-alpha.18
    hostname: tldraw
    container_name: tldraw-dev
    environment:
      TZ: Asia/Shanghai
    ports:
      - "3000:3000"

Dockerfile

FROM node:16-alpine AS BASE

WORKDIR /app
COPY . .

RUN npm install --registry=https://registry.npmmirror.com

EXPOSE 3000

CMD ["npm", "run", "start"]

# docker run --name tldraw -p 3000:3000 -d geekyouth/tldraw:2.0.0-alpha.18
steveruizok commented 8 months ago

Hi, closing this one. We're still looking at what a self-hostable version of tldraw could look like. Check https://github.com/tldraw/tldraw for the latest!