33 lines
883 B
Docker
33 lines
883 B
Docker
# Set the base image
|
|
FROM rust:latest as builder
|
|
|
|
# Install dependencies
|
|
RUN apt-get update && apt-get install -y protobuf-compiler
|
|
|
|
# Build the Anki sync server
|
|
WORKDIR /usr/src/ankisyncd
|
|
RUN cargo install --git https://github.com/ankitects/anki.git --tag 2.1.66 anki-sync-server
|
|
|
|
# Create a deploy image for smaller size
|
|
FROM debian:bookworm-slim
|
|
COPY --from=builder /usr/local/cargo/bin/anki-sync-server /usr/local/bin/
|
|
|
|
# Set environment variables for the sync server
|
|
ENV ANKISYNCD_DATA_ROOT=/data
|
|
ENV ANKISYNCD_AUTH_DB_PATH=/data/auth.db
|
|
ENV ANKISYNCD_SESSION_DB_PATH=/data/session.db
|
|
ENV SYNC_BASE=/data
|
|
|
|
# Create a directory for data
|
|
VOLUME /data
|
|
|
|
# Expose the default port
|
|
EXPOSE 27701
|
|
|
|
# Copy the entrypoint script and make it executable
|
|
COPY bin/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Set the entrypoint for the container
|
|
ENTRYPOINT ["/entrypoint.sh"]
|