-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
31 lines (24 loc) · 891 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM rust:1.61 as build
RUN apt-get update && apt-get -y install protobuf-compiler
# create a new empty shell project
RUN USER=root mkdir -p /usr/src && cd /usr/src && cargo new --bin kvdbd
WORKDIR /usr/src/kvdbd
# copy your source tree
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./kvdb-lib ./kvdb-lib
COPY ./kvdb-server ./kvdb-server
COPY ./kvdb-tools ./kvdb-tools
# build for release
RUN cargo update && cargo fetch
RUN cargo build --release
RUN ( cd kvdb-server && cargo install --path . )
RUN ( cd kvdb-tools && cargo install --path . )
# our final base
FROM rust:1.61-slim-buster
# copy the build artifact from the build stage
COPY --from=build /usr/src/kvdbd/target/release/kvdbd .
COPY --from=build /usr/src/kvdbd/target/release/kvcli .
COPY --from=build /usr/src/kvdbd/target/release/tester .
# set the startup command to run your binary
CMD ["kvdbd"]