tinymist/Dockerfile
Myriad-Dreamin 2c198a3d6a
Some checks failed
tinymist::auto_tag / auto-tag (push) Has been cancelled
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / announce (push) Has been cancelled
tinymist::ci / build (push) Has been cancelled
fix: set position_encoding on handshake and fix to utf-16 (#2153)
Although we don't have enough tests about utf-8 position encoding, i.e.
it is not good to decide to use utf-8, it is completely wrong to not
passing a decided encoding back to client on initialization.

Edit: it doesn't work correctly under utf-8, so we currently always use
utf-16. We may fix it in v0.14
2025-10-17 11:39:20 +08:00

48 lines
1.6 KiB
Docker

# ```shell
# docker build -t myriaddreamin/tinymist:latest .
# ```
#
# ## References
#
# https://stackoverflow.com/questions/58473606/cache-rust-dependencies-with-docker-build
# https://stackoverflow.com/a/64528456
# https://depot.dev/blog/rust-dockerfile-best-practices
ARG RUST_VERSION=1.89.0
FROM rust:${RUST_VERSION}-bookworm AS base
RUN apt-get install -y git
RUN cargo install sccache --version ^0.7
RUN cargo install cargo-chef --version ^0.1
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
# to download the toolchain
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
rustup update
FROM base as planner
WORKDIR app
# We only pay the installation cost once,
# it will be cached from the second build onwards
RUN cargo install cargo-chef
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo +${RUST_VERSION} chef prepare --recipe-path recipe.json
FROM base as builder
WORKDIR app
RUN cargo install cargo-chef
COPY --from=planner /app/recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo +${RUST_VERSION} chef cook --release --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo +${RUST_VERSION} build --bin tinymist --release
FROM debian:12
WORKDIR /app/
COPY --from=builder /app/target/release/tinymist /usr/local/bin
ENTRYPOINT ["/usr/local/bin/tinymist"]