add dockerfiles
This commit is contained in:
parent
caf67bf618
commit
683462cc10
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
FROM rust:bookworm as rust
|
||||||
|
|
||||||
|
FROM rust as chef
|
||||||
|
RUN apt update && apt install -y build-essential && cargo install --locked cargo-chef
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM chef as planner
|
||||||
|
COPY . .
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM chef AS builder
|
||||||
|
RUN apt install -y libprotobuf-dev protobuf-compiler
|
||||||
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --release --package chat-signaling-server --bin server
|
||||||
|
|
||||||
|
FROM debian:bookworm AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/target/release/server /usr/local/bin
|
||||||
|
ENTRYPOINT ["/usr/local/bin/server"]
|
21
Dockerfile.alpine
Normal file
21
Dockerfile.alpine
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
FROM rust:alpine as rust
|
||||||
|
|
||||||
|
FROM rust as chef
|
||||||
|
RUN apk add libc-dev musl-dev && cargo install --locked cargo-chef
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM chef as planner
|
||||||
|
COPY . .
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM chef AS builder
|
||||||
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
|
RUN apk add protoc protobuf-dev
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --release --package chat-signaling-server --bin server
|
||||||
|
|
||||||
|
FROM alpine AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/target/release/server /usr/local/bin
|
||||||
|
ENTRYPOINT ["/usr/local/bin/server"]
|
Loading…
x
Reference in New Issue
Block a user