Files
atuin-mirror/Dockerfile
Ellie Huxtable c9c0cb2a09 fix: copy vendored axoasset into docker builder stage (#3816)
## Problem

The `build-docker` workflow has been failing on main since #3813 landed:

```
error: failed to load source for dependency `axoasset`
Caused by:
  failed to read `/app/vendor/axoasset/Cargo.toml`
Caused by:
  No such file or directory (os error 2)
thread 'main' panicked at .../cargo-chef-0.1.77/src/recipe.rs:224:27
```

#3813 added `[patch.crates-io] axoasset = { path = "vendor/axoasset" }`.
cargo-chef's recipe skeletons workspace members and their path
dependencies, but not crates pulled in via a `[patch]` path — so the
`cargo chef cook` step in the builder stage tries to read the real
`vendor/axoasset/Cargo.toml`, which was never copied into that layer.

## Fix

Copy `vendor/` into the builder stage before `cargo chef cook`. Vendor
changes are rare, so this barely affects layer caching.

## Verification

Reproduced and verified outside docker with the exact toolchain from the
image (rust 1.97.0, cargo-chef 0.1.77): `cargo chef prepare` + `cook
--release` in a bare directory fails with the identical panic; with
`vendor/` copied alongside the recipe, cook completes cleanly (451
crates, exit 0).

## Checks
- [x] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [x] I have checked that there are no existing pull requests for the
same thing
2026-07-30 18:47:03 -07:00

44 lines
1.5 KiB
Docker

FROM lukemathwalker/cargo-chef:latest-rust-1.97.0-slim-bookworm AS chef
WORKDIR app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
# Ensure working C compile setup (not installed by default in arm64 images)
RUN apt update && apt install build-essential libssl-dev pkg-config -y
COPY --from=planner /app/recipe.json recipe.json
# The recipe references the [patch.crates-io] axoasset path dependency, but
# cargo-chef does not skeleton patched crates, so the real sources are needed
COPY vendor vendor
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin atuin-server
FROM debian:bookworm-20260713-slim AS runtime
LABEL org.opencontainers.image.source="https://github.com/atuinsh/atuin" \
org.opencontainers.image.url="https://atuin.sh" \
org.opencontainers.image.licenses="MIT"
RUN useradd -c 'atuin user' atuin && mkdir /config && chown atuin:atuin /config
# ca-certificates for webhooks to work, curl for the healthcheck
RUN apt update && apt install --no-install-recommends ca-certificates curl libssl3 -y && rm -rf /var/lib/apt/lists/*
WORKDIR app
USER atuin
ENV TZ=Etc/UTC
ENV RUST_LOG=atuin_server=info
ENV ATUIN_CONFIG_DIR=/config
COPY --from=builder /app/target/release/atuin-server /usr/local/bin
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -fsS -o /dev/null "http://localhost:${ATUIN_PORT:-8888}/healthz"
ENTRYPOINT ["/usr/local/bin/atuin-server"]