2023-09-07 10:52:31 +00:00
|
|
|
# Set the base image
|
|
|
|
FROM rust:latest as builder
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# Install dependencies
|
|
|
|
RUN apt-get update && apt-get install -y protobuf-compiler
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# 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
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# Create a deploy image for smaller size
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
COPY --from=builder /usr/local/cargo/bin/anki-sync-server /usr/local/bin/
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# 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
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# Create a directory for data
|
|
|
|
VOLUME /data
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# Expose the default port
|
|
|
|
EXPOSE 27701
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# Copy the entrypoint script and make it executable
|
|
|
|
COPY bin/entrypoint.sh /entrypoint.sh
|
|
|
|
RUN chmod +x /entrypoint.sh
|
2023-09-06 17:09:19 +00:00
|
|
|
|
2023-09-07 10:52:31 +00:00
|
|
|
# Set the entrypoint for the container
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|