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

Docker for anki sync #2715

Closed
sbhal opened this issue Oct 9, 2023 · 11 comments
Closed

Docker for anki sync #2715

sbhal opened this issue Oct 9, 2023 · 11 comments
Labels
forums.ankiweb.net please post questions, feature requests, and "doesn't work for me" reports on the user forum

Comments

@sbhal
Copy link

sbhal commented Oct 9, 2023

Can we have official docker image to run sync server?

@dae
Copy link
Member

dae commented Oct 9, 2023

Feature requests belong on the forums. This is not something I'm likely to add in the near future, but it should be fairly simple to build yourself.

@dae dae closed this as completed Oct 9, 2023
@dae dae added the forums.ankiweb.net please post questions, feature requests, and "doesn't work for me" reports on the user forum label Oct 9, 2023
@LuckyTurtleDev
Copy link

LuckyTurtleDev commented Nov 2, 2023

First version of docker prototype.
This version is currently limited to x86. Since many user probably would like to use Raspberry Pi to host an armv7 and armv8 version should also be a good idea.

FROM rust AS builder
SHELL ["/bin/bash", "-uo", "pipefail", "-c"]

ENV TARGET x86_64-unknown-linux-musl
RUN rustup target add "$TARGET"

RUN apt-get -y update && apt-get -y install protobuf-compiler musl musl-dev musl-tools
ENV PROTOC=/usr/bin/protoc
RUN cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag 23.10 anki-sync-server
RUN ldd /usr/local/cargo/bin/anki-sync-server


FROM scratch
ENV SYNC_BASE=/data
COPY --from=builder --chmod=0755 /usr/local/cargo/bin/anki-sync-server /
CMD ["./anki-sync-server"]

edit: see https://github.com/LuckyTurtleDev/docker-images/tree/main/dockerfiles/anki.

@sethidden
Copy link

sethidden commented Dec 26, 2023

Also linking LuckyTurtleDev's later update with a published container image and discussion with Damien (dae) in a PR:
#2798 (comment)

@JiangLongLiu
Copy link

First version of docker prototype. This version is currently limited to x86. Since many user probably would like to use Raspberry Pi to host an armv7 and armv8 version should also be a good idea.

FROM rust AS builder
SHELL ["/bin/bash", "-uo", "pipefail", "-c"]

ENV TARGET x86_64-unknown-linux-musl
RUN rustup target add "$TARGET"

RUN apt-get -y update && apt-get -y install protobuf-compiler musl musl-dev musl-tools
ENV PROTOC=/usr/bin/protoc
RUN cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag 23.10 anki-sync-server
RUN ldd /usr/local/cargo/bin/anki-sync-server


FROM scratch
ENV SYNC_BASE=/data
COPY --from=builder --chmod=0755 /usr/local/cargo/bin/anki-sync-server /
CMD ["./anki-sync-server"]

When I used this dockerfile to build, the following error occurred. I don’t know the reason. Can you please tell me the cause of the error?

Step 10/15 : RUN cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag ${version} anki-sync-server
 ---> Running in 7e0b9aaa711f
    Updating git repository `https://github.com/ankitects/anki.git`
    Updating git submodule `https://github.com/ankitects/anki-core-i18n.git`
    Updating git submodule `https://github.com/ankitects/anki-desktop-ftl.git`
    Updating git submodule `https://github.com/ankitects/PyOxidizer.git`
error: could not find `anki-sync-server` in https://github.com/ankitects/anki.git?tag=23.10 with version `*`
The command '/bin/bash -uo pipefail -c cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag ${version} anki-sync-server' returned a non-zero code: 101

image

@sethidden
Copy link

@JiangLongLiu Any reason you're trying to build yourself? You can use the already published and working image linked in #2715 (comment)

https://github.com/LuckyTurtleDev/docker-images/pkgs/container/anki

@JiangLongLiu
Copy link

JiangLongLiu commented Jan 11, 2024

@JiangLongLiu Any reason you're trying to build yourself? You can use the already published and working image linked in #2715 (comment)

https://github.com/LuckyTurtleDev/docker-images/pkgs/container/anki

Thank you very much for your help, the image has been downloaded.

Due to network issues in my area, I cannot download the image directly from ghcr.io. So I took a zigzag approach

  1. Download the image through the proxy website
    docker pull ghcr.dockerproxy.com/luckyturtledev/anki:23.12.1
  2. Rename the downloaded image
    docker tag ghcr.dockerproxy.com/luckyturtledev/anki:23.12.1 ghcr.io/luckyturtledev/anki:23.12.1
  3. Delete the image downloaded through the proxy
    docker rmi ghcr.dockerproxy.com/luckyturtledev/anki:23.12.1

How should I build a docker container through docker-compose? Is there any corresponding blog article that I can refer to?

@LuckyTurtleDev
Copy link

How should I build a docker container through docker-compose? Is there any corresponding blog article that I can refer to?

You remove image: SOMEIMAGE and add instead build: . or build: SOMEPATH .

@LuckyTurtleDev
Copy link

When I used this dockerfile to build, the following error occurred.

I have rebuild the image, but can not reproduce your error.

Is their any reason, why you build an outdated version from anki?

@LuckyTurtleDev
Copy link

LuckyTurtleDev commented Jan 11, 2024

Keep in mint the Dockerfile might change in future.

The current version of Dockerfile, prebuild image and doc is available at: https://github.com/LuckyTurtleDev/docker-images/tree/main/dockerfiles/anki.

@JiangLongLiu
Copy link

Keep in mint the Dockerfile might change in future.

The current version of Dockerfile, prebuild image and doc is available at: https://github.com/LuckyTurtleDev/docker-images/tree/main/dockerfiles/anki.

thank you very much !

@JiangLongLiu
Copy link

When I used this dockerfile to build, the following error occurred.

I have rebuild the image, but can not reproduce your error.

Is their any reason, why you build an outdated version from anki?

Because I specified the version number to build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forums.ankiweb.net please post questions, feature requests, and "doesn't work for me" reports on the user forum
Projects
None yet
Development

No branches or pull requests

5 participants