Skip to content

Commit df8aa88

Browse files
authored
Add a cache layer to Docker for development (#594)
* Add a cache layer to Docker. * Created a separate `dev` Docker file. * Fixed `Docker.dev` to build in non-release mode.
1 parent 7f5639c commit df8aa88

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Dockerfile.dev

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
2+
3+
RUN apt-get update && \
4+
apt-get install -y build-essential
5+
6+
WORKDIR /app
7+
8+
FROM chef AS planner
9+
COPY . .
10+
RUN cargo chef prepare --recipe-path recipe.json
11+
12+
FROM chef AS builder
13+
COPY --from=planner /app/recipe.json recipe.json
14+
# Build dependencies - this is the caching Docker layer!
15+
RUN cargo chef cook --release --recipe-path recipe.json
16+
# Build application
17+
COPY . .
18+
RUN cargo build
19+
20+
FROM debian:bookworm-slim
21+
COPY --from=builder /app/target/release/pgcat /usr/bin/pgcat
22+
COPY --from=builder /app/pgcat.toml /etc/pgcat/pgcat.toml
23+
WORKDIR /etc/pgcat
24+
ENV RUST_LOG=info
25+
CMD ["pgcat"]

0 commit comments

Comments
 (0)