init
This commit is contained in:
37
ticktalk/docker/backend/Dockerfile
Executable file
37
ticktalk/docker/backend/Dockerfile
Executable file
@@ -0,0 +1,37 @@
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.91.1-slim-trixie AS chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY crates/ ./crates/
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
|
||||
COPY . .
|
||||
RUN cargo build --release --bin ticktalk-backend
|
||||
|
||||
FROM ubuntu:24.04 AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
COPY docker/backend/entrypoint.sh .
|
||||
COPY --from=builder /app/target/release/ticktalk-backend /usr/local/bin/backend
|
||||
COPY --from=builder /usr/local/cargo/bin/diesel ./diesel
|
||||
COPY --chmod=755 client/kauth /usr/local/bin/kauth
|
||||
COPY crates/db/migrations ./migrations
|
||||
COPY crates/db/diesel.toml .
|
||||
|
||||
RUN apt-get update && apt install -y \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& chmod +x ./entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "./entrypoint.sh" ]
|
||||
Reference in New Issue
Block a user