2023-10-18 00:39:55 +02:00
|
|
|
FROM lukemathwalker/cargo-chef:latest-rust-1.73.0-buster AS chef
|
2021-04-20 22:53:07 +02:00
|
|
|
WORKDIR app
|
2021-11-13 23:45:50 +01:00
|
|
|
|
|
|
|
FROM chef AS planner
|
2021-04-20 22:53:07 +02:00
|
|
|
COPY . .
|
2021-11-13 23:45:50 +01:00
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
2021-04-20 22:53:07 +02:00
|
|
|
|
2021-11-13 23:45:50 +01:00
|
|
|
FROM chef AS builder
|
2022-05-09 22:09:31 +02:00
|
|
|
|
|
|
|
# Ensure working C compile setup (not installed by default in arm64 images)
|
|
|
|
RUN apt update && apt install build-essential -y
|
|
|
|
|
2021-04-20 22:53:07 +02:00
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
RUN cargo build --release --bin atuin
|
|
|
|
|
2023-10-18 00:39:37 +02:00
|
|
|
FROM debian:bullseye-20231009-slim AS runtime
|
2022-08-21 23:06:14 +02:00
|
|
|
|
|
|
|
RUN useradd -c 'atuin user' atuin && mkdir /config && chown atuin:atuin /config
|
2023-06-16 22:59:52 +02:00
|
|
|
# Install ca-certificates for webhooks to work
|
|
|
|
RUN apt update && apt install ca-certificates -y && rm -rf /var/lib/apt/lists/*
|
2021-04-20 22:53:07 +02:00
|
|
|
WORKDIR app
|
2021-04-21 19:13:51 +02:00
|
|
|
|
2022-08-21 23:06:14 +02:00
|
|
|
USER atuin
|
|
|
|
|
2021-04-21 19:13:51 +02:00
|
|
|
ENV TZ=Etc/UTC
|
2021-04-25 19:21:52 +02:00
|
|
|
ENV RUST_LOG=atuin::api=info
|
2021-04-21 19:13:51 +02:00
|
|
|
ENV ATUIN_CONFIG_DIR=/config
|
|
|
|
|
2021-04-20 22:53:07 +02:00
|
|
|
COPY --from=builder /app/target/release/atuin /usr/local/bin
|
|
|
|
ENTRYPOINT ["/usr/local/bin/atuin"]
|