From 035611439f6d047948fa094b04fb7b606f184f74 Mon Sep 17 00:00:00 2001 From: luckyturtledev Date: Thu, 2 Nov 2023 17:43:39 +0100 Subject: [PATCH 1/2] start docker --- Dockerfile | 16 ++++++++++++++++ docker-compose.yml | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..0e5402ae590 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM rust AS builder +SHELL ["/bin/bash", "-uo", "pipefail", "-c"] + +ENV TARGET x86_64-unknown-linux-musl +RUN rustup target add "$TARGET" + +RUN apt-get -y update && apt-get -y install protobuf-compiler musl musl-dev musl-tools +ENV PROTOC=/usr/bin/protoc +RUN cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag 23.10 anki-sync-server +RUN ldd /usr/local/cargo/bin/anki-sync-server + + +FROM scratch +ENV SYNC_BASE=/data +COPY --from=builder --chmod=0755 /usr/local/cargo/bin/anki-sync-server / +CMD ["./anki-sync-server"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000000..7623e9638bf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.3' +services: + crab-hole: + build: . + environment: + - SYNC_USER1=user:pass + volumes: + - './data:/data' + ports: + - "8080:8080/tcp" From 966172a7e35415a1d290c82d2356f6d632a0eae6 Mon Sep 17 00:00:00 2001 From: luckyturtledev Date: Thu, 2 Nov 2023 19:43:09 +0100 Subject: [PATCH 2/2] make tag configurable --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0e5402ae590..92143713ae8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,14 @@ FROM rust AS builder SHELL ["/bin/bash", "-uo", "pipefail", "-c"] +ARG version + ENV TARGET x86_64-unknown-linux-musl RUN rustup target add "$TARGET" RUN apt-get -y update && apt-get -y install protobuf-compiler musl musl-dev musl-tools ENV PROTOC=/usr/bin/protoc -RUN cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag 23.10 anki-sync-server +RUN cargo install --locked --target "$TARGET" --git https://github.com/ankitects/anki.git --tag ${version} anki-sync-server RUN ldd /usr/local/cargo/bin/anki-sync-server