mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00

Otherwise data would be lost by default when removing (or re-creating) a container. It would be possible to expose the default directory (e.g. /home/anki/.syncserver) but it would be different for the two Dockerfiles and less convenient for users of the Docker container to specify such a long path when naming their volumes. Setting the permissions is necessary since anki will be running with 'anki' user permissions inside the container.
33 lines
892 B
Text
33 lines
892 B
Text
FROM rust:1.83.0 AS builder
|
|
|
|
ARG ANKI_VERSION
|
|
|
|
RUN apt-get update && apt-get install -y build-essential protobuf-compiler && apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN cargo install --git https://github.com/ankitects/anki.git \
|
|
--tag ${ANKI_VERSION} \
|
|
--root /anki-server \
|
|
anki-sync-server
|
|
|
|
FROM gcr.io/distroless/cc-debian12
|
|
|
|
ARG SYNC_PORT=8080
|
|
|
|
COPY --from=builder /anki-server/bin/anki-sync-server /usr/bin/anki-sync-server
|
|
|
|
ENV SYNC_PORT=${SYNC_PORT}
|
|
|
|
ENV SYNC_BASE=/anki_data
|
|
|
|
EXPOSE ${SYNC_PORT}
|
|
|
|
CMD ["anki-sync-server"]
|
|
|
|
# This health check will work for Anki versions 24.08.x and newer.
|
|
# For older versions, it may incorrectly report an unhealthy status, which should not be the case.
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD ["anki-sync-server", "--healthcheck"]
|
|
|
|
VOLUME /anki_data
|
|
|
|
LABEL maintainer="Jean Khawand <jk@jeankhawand.com>"
|