-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix existing rust Dockerfile (#1844)
* fix existing rust Dockerfile * fmt --------- Co-authored-by: Shivam Kapoor <[email protected]> Co-authored-by: Shivam <[email protected]>
- Loading branch information
1 parent
a520c65
commit 82607f4
Showing
5 changed files
with
174 additions
and
182 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
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,40 +1,25 @@ | ||
FROM rust:1.77 AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY Cargo.toml Cargo.lock ./ | ||
RUN sed -i '/default-members/d' Cargo.toml | ||
RUN sed -i '/members = \[/,/\]/c\members = ["raphtory", "raphtory-graphql"]' Cargo.toml | ||
|
||
WORKDIR /app/raphtory | ||
COPY raphtory/Cargo.toml ./ | ||
RUN mkdir src && echo "fn main() {}" > src/main.rs | ||
|
||
WORKDIR /app/raphtory-graphql | ||
COPY raphtory-graphql/Cargo.toml ./ | ||
RUN mkdir src && echo "fn main() {}" > src/main.rs | ||
|
||
FROM rust:1.80.0 AS chef | ||
RUN cargo install cargo-chef --version 0.1.67 | ||
WORKDIR /app | ||
RUN cargo build --release --workspace | ||
|
||
COPY raphtory ./raphtory | ||
COPY raphtory-graphql ./raphtory-graphql | ||
|
||
WORKDIR /app/raphtory-graphql | ||
RUN cargo build --release | ||
|
||
FROM rust:1.77-slim AS runner | ||
|
||
WORKDIR /app | ||
|
||
RUN groupadd -g 999 appuser && \ | ||
useradd -r -u 999 -g appuser appuser | ||
USER appuser | ||
|
||
COPY --from=builder /app/target/release/raphtory-graphql /app | ||
|
||
EXPOSE 1736 | ||
|
||
ENV GRAPH_DIRECTORY=graphs | ||
|
||
CMD ["./raphtory-graphql"] | ||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
RUN apt-get update | ||
RUN apt-get install -y protobuf-compiler | ||
COPY --from=planner /app/recipe.json recipe.json | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
# RUN cargo chef cook --recipe-path recipe.json | ||
COPY . . | ||
RUN cargo build --release -p raphtory-graphql | ||
# RUN cargo build -p raphtory-graphql | ||
|
||
# FROM alpine:3.20.3 | ||
FROM debian:bookworm-slim | ||
ENV PORT=1736 | ||
COPY --from=builder /app/target/release/raphtory-graphql /raphtory-graphql | ||
# COPY --from=builder /app/target/debug/raphtory-graphql /usr/local/bin/raphtory-graphql | ||
WORKDIR /graphs | ||
CMD ["/raphtory-graphql"] |
Oops, something went wrong.