kampffrosch94 / jpdb-connect

connect yomichan with jpdb via anki connect protocol
MIT License
24 stars 5 forks source link

Unable to run in a container #12

Closed luizbafilho closed 1 year ago

luizbafilho commented 1 year ago

I'm trying to build and run jpdb-connect using containers, but when yomichan makes the request to it, it fails to respond.

Here is the dockerfile:

FROM rust:1.64.0

RUN git clone https://github.com/kampffrosch94/jpdb-connect.git /jpdb-connect

WORKDIR /jpdb-connect

RUN cargo install --path .

CMD ["jpdb_connect"]

Here is logs:

[16:20:22][jpdb_connect][DEBUG] Anki-connect answer: '6'
[16:20:22][jpdb_connect][DEBUG] POST / 200 OK
[16:20:25][jpdb_connect][TRACE] Request received:
[16:20:25][jpdb_connect][TRACE] {"action":"addNote","params":{"note":{"fields":{"word":"読む","reading":"よむ","sentence":"読め"},"tags":["yomichan"],"deckName":"jpdb","modelName":"jpdb","options":{"allowDuplicate":true,"duplicateScope":"collection","duplicateScopeOptions":{"deckName":null,"checkChildren":false,"checkAllModels":false}}}},"version":2}
[16:20:25][jpdb_connect][DEBUG] addNote
[16:20:25][jpdb_connect::jpdb][DEBUG] add W='読む' R='よむ' S='読め'
[16:20:25][jpdb_connect::jpdb][TRACE] Request url: https://jpdb.io/search?q=%E8%AA%AD%E3%82%80&lang=english#a
[16:20:25][jpdb_connect::jpdb][INFO] Opening: https://jpdb.io/vocabulary/1456360/読む
[16:20:25][jpdb_connect][ERROR] disabled backtrace
[16:20:25][jpdb_connect][DEBUG] Anki-connect answer: '{"result": null, "error": "gio: https://jpdb.io/vocabulary/1456360/??: Operation not supported (exit status: 2)"}'
[16:20:25][jpdb_connect][DEBUG] POST / 200 OK

To build just do docker build -t jpdb-connect .

The reason I'm building it myself in the container is that I'll run it in arm64 machine, and there is no release for that platform, if you could add one, it would make my life easier too. 😄

Let me know if you need anything else.

luizbafilho commented 1 year ago

I've just figured it out, I had auto_open enabled. Disabling it solved the issue.

kampffrosch94 commented 1 year ago

The github action I use to build the release doesn't support arm afaik (and I am too lazy to muck around with that, since I can't test it) You could just build on the arm64 machine and it should work.

Auto open uses xdg-open on linux, you could configure that to do something appropriate if you want to use that option.