ankicommunity/anki-sync-server-rs

Dockerfile suggestions

Closed this issue · 2 comments

For anyone interested in a Dockerfile that doesn't need to compile for 15+ minutes. It is possible to specify the version as argument, otherwise the latest version is used.
Another option would be to directly publish a docker image on dockerhub (or other registry) by a CI job.
The current Dockerfile also doesn't specify a workdir so it's not easy to have a persistant storage by using a volume.

FROM alpine:latest
ARG VERSION
ARG PLATFORM=linux
WORKDIR /app
RUN if [[ -z "$VERSION" ]] ; then \
    wget -q https://api.github.com/repos/ankicommunity/anki-sync-server-rs/releases/latest -O - \
    | grep "browser_download_url.*tar.gz" | cut -d : -f 2,3 | tr -d \" | grep ${PLATFORM} | xargs wget -O ankisyncd.tar.gz -q; \
    else \
    wget https://github.com/ankicommunity/anki-sync-server-rs/releases/download/${VERSION}/ankisyncd-${VERSION}-${PLATFORM}.tar.gz -O ankisyncd.tar.gz; \
    fi \
    && tar -xf ankisyncd.tar.gz \
    && rm ankisyncd.tar.gz \
    && mv ankisyncd-${PLATFORM}/ankisyncd /usr/local/bin/ankisyncd \
    && mv ankisyncd-${PLATFORM}/Settings.toml . \
    && rmdir ankisyncd-${PLATFORM}

ENTRYPOINT ["ankisyncd"]
HEALTHCHECK --interval=30s --timeout=3s CMD wget --spider -q http://0.0.0.0:27701
EXPOSE 27701

Seems like a good idea (but I think going for a debian-slim base image would be for the best as it induces less compile&performances problems than alpine+muslc).

No need for a WORKIDIR as the sync server working folder is set via the configuration file,
just pass ankisyncd -c /app/ankisyncd.toml as entry point and mount /app in the local file fs as a volume.


I want to go the registry way but this will have to wait until we have a CI system up and running.
Let's keep this open until we have a correct CI system.

built image from docker registry should be available.And I modify the Dockerfile a bit,so hopefully this will make persisting data possible.