2022-12-30 19:09:47 +01:00
|
|
|
# install dependencies
|
|
|
|
FROM rust:slim-bullseye AS compiler
|
2023-01-22 13:05:07 +01:00
|
|
|
RUN apt update && apt install -y libclang-dev clang \
|
2023-01-05 14:02:08 +01:00
|
|
|
build-essential tcl protobuf-compiler file
|
2022-12-30 19:09:47 +01:00
|
|
|
RUN cargo install cargo-chef
|
2023-01-05 13:22:28 +02:00
|
|
|
WORKDIR /sqld
|
2022-12-30 19:09:47 +01:00
|
|
|
|
|
|
|
# prepare recipe
|
|
|
|
FROM compiler AS planner
|
|
|
|
COPY . .
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
2023-01-05 13:22:28 +02:00
|
|
|
# build sqld
|
2022-12-30 19:09:47 +01:00
|
|
|
FROM compiler AS builder
|
2023-01-05 13:22:28 +02:00
|
|
|
COPY --from=planner sqld/recipe.json recipe.json
|
2022-12-30 19:09:47 +01:00
|
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
COPY . .
|
2023-01-06 12:18:02 +01:00
|
|
|
RUN cargo build --release -p sqld
|
2022-12-30 19:09:47 +01:00
|
|
|
|
|
|
|
# runtime
|
|
|
|
FROM debian:bullseye-slim
|
2023-01-05 13:22:28 +02:00
|
|
|
COPY --from=builder /sqld/target/release/sqld /bin/sqld
|
2022-12-31 12:04:09 +02:00
|
|
|
COPY docker-entrypoint.sh /usr/local/bin
|
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
|
|
|
2023-01-14 15:18:14 +02:00
|
|
|
EXPOSE 5001 5432 8080
|
2023-01-03 22:29:55 +02:00
|
|
|
CMD ["/bin/sqld"]
|