From 9a50ab1232c272a022415636df6c2f4885e74d55 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Tue, 29 Jul 2025 15:18:44 +0200 Subject: [PATCH 1/3] Add cli Dockerfile Shamelessly vibe coded shit to add simple docker image to run the cli :) --- Dockerfile.cli | 27 +++++++++++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 33 insertions(+) create mode 100644 Dockerfile.cli diff --git a/Dockerfile.cli b/Dockerfile.cli new file mode 100644 index 000000000..1271ef653 --- /dev/null +++ b/Dockerfile.cli @@ -0,0 +1,27 @@ +FROM rust:1.88.0 as builder + +WORKDIR /app + +# Copy workspace files for dependency resolution +COPY Cargo.toml Cargo.lock rust-toolchain.toml ./ +COPY cli/Cargo.toml ./cli/ +COPY core/Cargo.toml ./core/ +COPY extensions/completion/Cargo.toml ./extensions/completion/ +COPY macros/Cargo.toml ./macros/ + +# Copy the actual source code +COPY . . + +# Build the CLI binary +RUN cargo build --package turso_cli + +# Runtime stage +FROM rust:1.88.0-slim + +WORKDIR /app + +# Copy the built binary +COPY --from=builder /app/target/debug/tursodb /usr/local/bin/ + +# Set the entrypoint +ENTRYPOINT ["tursodb"] diff --git a/README.md b/README.md index c666770b6..e921f30ba 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,12 @@ You can also build and run the latest development version with: cargo run ``` +If you like docker, we got you covered. Simply run this in the root folder: + +```bash +docker build -f Dockerfile.cli -t turso-cli . && docker run -it turso-cli +``` + ### MCP Server Mode The Turso CLI includes a built-in [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that allows AI assistants to interact with your databases. Start the MCP server with: From baa424bff6d825e91dc15b91da778e3cda3b7221 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Wed, 30 Jul 2025 11:45:24 +0200 Subject: [PATCH 2/3] release and remove copies --- Dockerfile.cli | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Dockerfile.cli b/Dockerfile.cli index 1271ef653..474b73c34 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -2,18 +2,11 @@ FROM rust:1.88.0 as builder WORKDIR /app -# Copy workspace files for dependency resolution -COPY Cargo.toml Cargo.lock rust-toolchain.toml ./ -COPY cli/Cargo.toml ./cli/ -COPY core/Cargo.toml ./core/ -COPY extensions/completion/Cargo.toml ./extensions/completion/ -COPY macros/Cargo.toml ./macros/ - # Copy the actual source code COPY . . # Build the CLI binary -RUN cargo build --package turso_cli +RUN cargo build --release --package turso_cli # Runtime stage FROM rust:1.88.0-slim @@ -21,7 +14,7 @@ FROM rust:1.88.0-slim WORKDIR /app # Copy the built binary -COPY --from=builder /app/target/debug/tursodb /usr/local/bin/ +COPY --from=builder /app/target/release/tursodb /usr/local/bin/ # Set the entrypoint ENTRYPOINT ["tursodb"] From 9cba19309ee2f23727a6c97a170675ae7fde85f8 Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Wed, 30 Jul 2025 23:58:38 -0400 Subject: [PATCH 3/3] Add .dockerignore and Makefile commands to support docker --- .dockerignore | 1 + Makefile | 6 ++++++ README.md | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..951727346 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +*target diff --git a/Makefile b/Makefile index a507700a0..ff1d42aaf 100644 --- a/Makefile +++ b/Makefile @@ -150,3 +150,9 @@ bench-exclude-tpc-h: cargo bench $$benchmarks; \ fi .PHONY: bench-exclude-tpc-h + +docker-cli-build: + docker build -f Dockerfile.cli -t turso-cli . + +docker-cli-run: + docker run -it -v ./:/app turso-cli diff --git a/README.md b/README.md index e921f30ba..8dc7cdc1b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,8 @@ cargo run If you like docker, we got you covered. Simply run this in the root folder: ```bash -docker build -f Dockerfile.cli -t turso-cli . && docker run -it turso-cli +make docker-cli-build && \ +make docker-cli-run ``` ### MCP Server Mode