Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add missing dot in Docker build command #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CMD x11vnc -forever -usepw -create -shared
```
Build the docker image:
```
docker build -f <custom_docker_file> -t vnckoappimage
docker build -f <custom_docker_file> -t vnckoappimage .
```
Using the modified docker image above, you can then run it headlessly, like so:
```
Expand All @@ -67,10 +67,45 @@ winpty docker exec -it vncko bash
```
From here, you can edit the frontend code. When you want to see your changes reflected, you can **Restart KOReader** from the emulator KOReader system menu.

### Updated KOReader
Allows you to work with a more recent version of KOReader.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what this means. Shouldn't you simply update the one above if something about it is outdated?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there might be a reason to work with a 2020 version of KOReader, but maybe I'm wrong. It's not my repo so I'd rather add than replace. It's up to you. I'm just sharing my meager experience of what I ended up with today after following your instructions.
In any case, with the current code, if you only modify the KOReader version for a newer one, without changing the rest of the code, you end up with dependency problems and linux versions that are too old. That's why I used Debian Bullseye and installed these dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, now I get it, well, the problem anyway. The latest tag hasn't been updated in a while because it's not done automatically anymore. Maybe it shouldn't even be there at all. The correct current image is koreader/koappimage:0.4.4-20.04.

But all old versions still work on the latest systems.

```
# Use Debian Bullseye as the base image
FROM debian:bullseye-slim
USER root

# Update packages and install x11vnc, xvfb, SDL2, and other dependencies
RUN apt-get update && apt-get install -y \
x11vnc \
xvfb \
libsdl2-2.0-0 \
libutf8proc2 \
libfontconfig1 \
libfreetype6

# Set up the VNC password
RUN mkdir -p ~/.vnc && x11vnc -storepasswd 1234 ~/.vnc/passwd

# Create the directory for KOReader
RUN mkdir -p /home/ko

# Download and extract the KOReader AppImage into /home/ko
# Feel free to update the koreader version
ADD https://github.com/koreader/koreader/releases/download/v2024.07/koreader-appimage-x86_64-linux-gnu-v2024.07.AppImage /home/ko/appimage

# Ensure the AppImage is executable and extract it
RUN chmod +x /home/ko/appimage && cd /home/ko && ./appimage --appimage-extract

# Start the VNC server
CMD x11vnc -forever -usepw -create -shared
```
The rest is as previously explained from "Build the Docker image:"

### Notes
* For some reason, if you close down the emulator after opening it then you lose keyboard focus in the xterm window
* You need to prefix you `docker exec` in Windows with `winpty` for an interactive session to work
* You don't need `winpty` if you use powershell
* The above steps were tested on Windows 10 with docker for desktop
* You could mount in the front end code using `-v` if you extracted the AppImage files locally, todo: demonstrate this
* You can of course `docker cp` your edited code out

* Be cautious not to run the default VNC server that comes with some VNC softwares, as you may experience an infinite screen duplication effect of the host's display instead of what we want