Docker setup for Lichess development. Based on BrandonE's original Lichess Docker setup (since that one doesn't work anymore).
- Clone or download this repo and
cd
into it - Build the image:
docker build --tag lichess .
- Clone or downlod lila and lila-ws. It's assumed they are placed in
$HOME/dev/lichess/{lila,lila-ws}
if you're on Linux or using Windows with WSL and inC:\dev\lichess
if you're running Docker directly from Windows. If you place them somewhere else, you'll have to modifydocker-run.sh
ordocker-run.bat
or the command below to use the correct path. - Create and start the container:
On Linux or WSL, either run ./docker-run.sh
or the following command (make sure to adjust $HOME/dev/lichess
if you cloned lila and lila-ws to a different directory):
docker run \
--mount type=bind,source=$HOME/dev/lichess,target=/home/lichess/projects \
--publish 9663:9663 \
--publish 9664:9664 \
--publish 8212:8212 \
--name lichess \
--interactive \
--tty \
lichess
If you are starting the container directly from Windows, you can use docker-run.bat
instead (again, make sure to adjust the mount point to the actual directory where lila and lila-ws are located). However, I strongly recommend running Docker from WSL 2 and placing lila and lila-ws in the WSL 2 file system since that will significantly speed up compilation.
- The contianer will automatically start redis and mongo but won't build or run any lila services, so you will have to do that manually. I generally create two additional sessions using
docker exec -it lichess bash
in new terminal windows:- One to run
lila-ws
usingcd ~/projects/lila-ws
andsbt run
. - Another to build UI stuff i.e. compile SCSS and TypeScript to CSS and JavaScript in
cd ~/projects/lila/ui
:./build
to build all the UI stuff. You should do this at least once the first time after cloning the project and probably again every time after pulling major changes../build dev css
to only build SCSScd analyse
andyarn dev
to build just theanalyse
module and similarly for other modules- And I also use this terminal for other miscellaneous stuff like accessing the db via
mongo lichess
.
- And ofc, the main session will be used to run lila itself using
./lila
and thenrun
. Before the first run, you should also runmongo lichess bin/mongodb/indexes.js
to create db indices. - You should also read the Lichess Development Onboarding guide on the Lichess GitHub wiki for additional instructions on seeding the db, gaining admin access, or running suplementary services like fishnet for server analysis or playing vs Stockfish
- One to run
Note, that with the run command above (or docker-run.sh
) or the start command below, the container will be stopped (but not deleted) when the main session exits, so that session always has to be kept alive and ideally should be terminated last.
- Stop the Docker container:
docker stop lichess
- Restart the Docker container and attach to it:
docker start lichess --attach --interactive
- Open a second shell in the running container:
docker exec -it lichess bash
- Remove the Docker container (e.g. to mount a different volume):
docker rm lichess
build/nvm-install.sh
is licensed under the MIT license. See the file's header.build/sdkman-init.sh
is licensed under the Apache 2.0 license. See the file's header.- All other code is in the public domain.