Files
anki/docs/syncserver/Dockerfile
RedPine404 29a2853f1d fix: Bump rust builder and base image for syncserver (#5036)
## Linked issue (required)

Fixes #5035

## Summary / motivation (required)

Rust builder is outdated an no longer builds the syncserver
successfully.

Bumping the version to match rust-toolchain.toml version 1.92.0 fixes
this issue.

I also bumped the base image to alpine:3.23 as alpine:3.21.0 is over a
year old.

## Steps to reproduce (required, use N/A if not applicable)

docker buildx build -f <Dockerfile> --no-cache --build-arg
ANKI_VERSION=<version> -t anki-sync-server .

## How to test (required)

docker buildx build -f <Dockerfile> --no-cache --build-arg
ANKI_VERSION=<version> -t anki-sync-server .

### Checklist (minimum)

- [x] I ran `docker buildx build -f Dockerfile --no-cache --build-arg
ANKI_VERSION=26.05 -t anki-sync-server .`
- [x] I ran `docker buildx build -f Dockerfile.distroless --no-cache
--build-arg ANKI_VERSION=26.05 -t anki-sync-server .`

### Details

Docker image compiled as expected following the updated versions.

## Scope

- [x] This PR is focused addressing the syncserver docker image.

Co-authored-by: Abdo <abdo@abdnh.net>
2026-06-19 18:10:39 +03:00

41 lines
1.1 KiB
Docker

FROM rust:1.92.0-alpine3.23 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 \
--locked \
anki-sync-server
FROM alpine:3.23
# 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>"