Just wanted to share my excitement of been able to create a docker container with picochess and access it remotely from my own domain and have access to all the mame chess engines using my Cheessnut Evo board. No more locked in using few engines provided by the board. I have a very low ELO but and all this new shiny engines are kicking my but.
I do have a Raspberry pi 4 with an LCD that connects to my Chessnut Air as well.
Also been able to connect to picochess from everyone is very exciting.
I did have some issues connecting from a different IP and asked AI to help me fixing. Just wanted to ask if this can solved or picochess is meant to be used only on local host 127.0.0.0. If you guys think this is possible I will open up an issue on github and share my Dockerfile and docker-compose.yml there as well. I guess this is a temporary solution cause every time I want to update picochess I have to rebuild the docker.
The one thing that doesn't work yet is the retrieval the the Games tab. The app.js is looking at the port 7778 on local host to communicate this info and I just didn't want to open up another port.
# ============================================================
# PicoChess - Debian Trixie Docker image
# Source:
https://github.com/JohanSjoblom/picochess# ============================================================
FROM debian:trixie
ENV DEBIAN_FRONTEND=noninteractive
ENV REPO_DIR=/opt/picochess
# System packages
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl wget ca-certificates unzip tar \
python3 python3-pip python3-venv python3-dev \
build-essential gcc pkg-config \
libffi-dev libssl-dev \
libglib2.0-dev \
libtcl8.6 tcl tk \
sox libsox-fmt-all vorbis-tools \
libsndfile1 libportaudio2 portaudio19-dev python3-pyaudio \
libopenblas-dev \
libsdl2-2.0-0 libsdl2-ttf-2.0-0 \
telnet i2c-tools rsync vim \
libgl1 libqt5widgets5t64 \
alsa-utils libasound2t64 \
&& rm -rf /var/lib/apt/lists/*
# Create pi user
RUN useradd -m -s /bin/bash pi \
&& echo 'pi:password' | chpasswd
# Clone PicoChess
RUN git clone
https://github.com/JohanSjoblom/picochess "$REPO_DIR" \
&& chown -R pi:pi "$REPO_DIR"
WORKDIR /opt/picochess
# Python virtualenv and dependencies
RUN python3 -m venv /opt/picochess/venv \
&& /opt/picochess/venv/bin/python -m pip install --upgrade pip setuptools wheel \
&& /opt/picochess/venv/bin/python -m pip install -r requirements.txt
# Config, voices, directories
RUN cp picochess.ini.example-web-$(uname -m) picochess.ini \
&& cp voices-example.ini talker/voices/voices.ini \
&& mkdir -p logs games/uploads \
&& sed -i 's/^web-server = 80/web-server = 8080/' picochess.ini \
&& chown -R pi:pi /opt/picochess
# Install engines and books as pi
USER pi
RUN ./install-engines.sh lite
RUN ./install-books-games.sh
# HTTPS reverse-proxy fix:
# Use wss:// for the /event WebSocket when PicoChess is loaded over HTTPS.
USER root
RUN python3 - <<'PY'
from pathlib import Path
p = Path("/opt/picochess/web/picoweb/static/js/app.js")
if not p.exists():
print("WARNING: app.js not found - skipping WebSocket patch")
exit(0)
s = p.read_text()
original = s
old = "new WebSocket('ws://' + location.host + '/event')"
new = (
"new WebSocket("
"(location.protocol === 'https:' ? 'wss://' : 'ws://') "
"+ location.host + '/event')"
)
if old in s:
s = s.replace(old, new)
print("Patched WebSocket ws:// -> wss:// for HTTPS")
else:
print("WARNING: WebSocket line not found - upstream app.js may have changed")
if s != original:
p.write_text(s)
print("app.js saved")
else:
print("No changes made")
PY
# Final permissions
RUN chown -R pi:pi /opt/picochess
# Expose internal PicoChess web port
EXPOSE 8080
USER pi
CMD ["/opt/picochess/venv/bin/python", "/opt/picochess/picochess.py"]