mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00

Hardcode them to: SYNC_PORT=8080 SYNC_BASE=/anki_data If these env variables are passed into the container with different values, they are ignored. The reasons is if the user modifies SYNC_BASE they risk data loss since anki-sync-server will no longer write data into the volume. If they change SYNC_PORT they need to also change it when mapping this internal port to the external port of the container, which could be confusing plus it has no benefit to allow this since it's always possible to change the external port even if the internal port is fixed to 8080 (e.g. `-p 1234:8080`). In both cases there is no benefit to making these values configurable and there are risks associated. Unfortunately there is no easy way of implementing this for the Dockerfile.distroless so it's up to the user not to modify these values.
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
FROM rust:1.83.0-alpine3.20 AS builder
|
|
|
|
ARG ANKI_VERSION
|
|
|
|
RUN apk update && apk add --no-cache build-base protobuf && rm -rf /var/cache/apk/*
|
|
|
|
RUN cargo install --git https://github.com/ankitects/anki.git \
|
|
--tag ${ANKI_VERSION} \
|
|
--root /anki-server \
|
|
anki-sync-server
|
|
|
|
FROM alpine:3.21.0
|
|
|
|
# Default PUID and PGID values (can be overridden at runtime). Use these to
|
|
# ensure the files on the volume have the permissions you need.
|
|
ENV PUID=1000
|
|
ENV PGID=1000
|
|
|
|
COPY --from=builder /anki-server/bin/anki-sync-server /usr/local/bin/anki-sync-server
|
|
|
|
RUN apk update && apk add --no-cache bash su-exec && rm -rf /var/cache/apk/*
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
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 wget -qO- http://127.0.0.1:8080/health || exit 1
|
|
|
|
VOLUME /anki_data
|
|
|
|
LABEL maintainer="Jean Khawand <jk@jeankhawand.com>"
|