File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/target /
2- Cargo.lock
32.env
43.git
5- docker /
4+ docker /
5+ .devcontainer /
6+ .vscode /
Original file line number Diff line number Diff line change @@ -2,13 +2,29 @@ FROM rust:1.90-bookworm as Builder
22
33ENV RUST_LOG=info,docker_proxy_filter=debug
44
5- WORKDIR /usr/src/app
6- COPY . .
5+ WORKDIR /app
76
7+ RUN cargo init
88
9- RUN cargo install --target x86_64-unknown-linux-gnu --path .
9+ COPY Cargo.lock Cargo.toml ./
10+
11+ # build dummy project with dependencies to get them compiled and cached
12+ RUN cargo build --release --target $(rustc --print host-tuple)
13+
14+ # copy full app code
15+ COPY src/ src/
16+ # updated modified timestamp so build runs again
17+ RUN touch src/main.rs
18+
19+ # build full app to host arch and copy to generic location
20+ RUN export ARCH=$(rustc --print host-tuple); \
21+ cargo build --release --target $ARCH \
22+ && mkdir build \
23+ && cp target/$ARCH/release/docker-proxy-filter build/docker-proxy-filter
1024
1125FROM debian:bookworm-slim
26+ # need ssl for web server
1227RUN apt-get update && apt-get upgrade -y && apt-get install openssl -y && apt clean && rm -rf /var/lib/apt/lists/*
13- COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-gnu/release/docker-proxy-filter /usr/local/bin/docker-proxy-filter
28+ # copy built app from generic location
29+ COPY --from=builder /app/build/docker-proxy-filter /usr/local/bin/docker-proxy-filter
1430CMD ["docker-proxy-filter" ]
You can’t perform that action at this time.
0 commit comments