-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
FROM rust:1.76.0 as builder | ||
ARG RUST_VERSION=1.76.0 | ||
FROM lukemathwalker/cargo-chef:0.1.66-rust-$RUST_VERSION as chef | ||
|
||
ENV SQLX_OFFLINE=true | ||
WORKDIR /dosei | ||
|
||
WORKDIR /usr/src/dosei | ||
|
||
RUN apt-get update && apt-get install -y build-essential protobuf-compiler python3.11-dev | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
RUN --mount=type=cache,target=target cargo build --release | ||
FROM chef AS builder | ||
|
||
RUN mkdir release | ||
RUN --mount=type=cache,target=target cp target/release/doseid release/doseid | ||
RUN --mount=type=cache,target=target cp target/release/dctl release/dctl | ||
RUN --mount=type=cache,target=target cp target/release/proxy release/proxy | ||
RUN apt-get update && apt-get install build-essential protobuf-compiler python3.11-dev -y | ||
|
||
COPY --from=planner /dosei/recipe.json recipe.json | ||
# Build dependencies - this is the caching Docker layer! | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
# Build Dosei | ||
COPY . . | ||
RUN cargo build --release | ||
|
||
FROM rust:1.76.0 | ||
FROM debian:12-slim AS runtime | ||
|
||
RUN apt-get update && apt-get install -y python3.11-dev | ||
LABEL org.opencontainers.image.title="Dosei" | ||
LABEL org.opencontainers.image.description="Official Dosei image" | ||
LABEL org.opencontainers.image.url="https://dosei.ai" | ||
LABEL org.opencontainers.image.documentation="https://dosei.ai/docs" | ||
LABEL org.opencontainers.image.source="https://github.com/doseiai/dosei" | ||
LABEL org.opencontainers.image.vendor="Dosei" | ||
|
||
ARG RELEASE_PATH=/usr/src/dosei/release | ||
ARG DOSEID_INSTALL=/bin/doseid | ||
ARG DOSEI_CLI_INSTALL=/bin/dctl | ||
ARG DOSEI_PROXY_INSTALL=/bin/dosei-proxy | ||
RUN apt-get update && apt-get install python3.11-dev -y | ||
|
||
COPY --from=builder ${RELEASE_PATH}/doseid ${DOSEID_INSTALL} | ||
COPY --from=builder ${RELEASE_PATH}/dctl ${DOSEI_CLI_INSTALL} | ||
COPY --from=builder ${RELEASE_PATH}/proxy ${DOSEI_PROXY_INSTALL} | ||
ARG RELEASE_PATH=/dosei/target/release | ||
ARG TAGET_PATH=/usr/local/bin | ||
|
||
RUN chmod +x ${DOSEID_INSTALL} ${DOSEI_CLI_INSTALL} ${DOSEI_PROXY_INSTALL} | ||
COPY --from=builder $RELEASE_PATH/doseid $TAGET_PATH | ||
COPY --from=builder $RELEASE_PATH/dctl $TAGET_PATH | ||
COPY --from=builder $RELEASE_PATH/proxy $TAGET_PATH | ||
|
||
CMD ["/bin/doseid"] | ||
ENTRYPOINT ["/usr/local/bin/doseid"] |