2020-05-27 22:01:26 +02:00
|
|
|
FROM rust:1-slim-buster AS base
|
2020-02-24 18:48:04 +01:00
|
|
|
|
2020-05-27 22:01:26 +02:00
|
|
|
ENV USER=root
|
2020-02-24 18:48:04 +01:00
|
|
|
|
2020-05-27 22:01:26 +02:00
|
|
|
WORKDIR /code
|
|
|
|
RUN cargo init
|
|
|
|
COPY Cargo.toml /code/Cargo.toml
|
|
|
|
RUN cargo fetch
|
2020-02-24 18:48:04 +01:00
|
|
|
|
2020-05-27 22:01:26 +02:00
|
|
|
COPY src /code/src
|
2020-02-24 18:48:04 +01:00
|
|
|
|
2020-05-27 22:01:26 +02:00
|
|
|
CMD [ "cargo", "test", "--offline" ]
|
2020-02-24 18:48:04 +01:00
|
|
|
|
2020-05-27 22:01:26 +02:00
|
|
|
FROM base AS builder
|
|
|
|
|
|
|
|
RUN cargo build --release --offline
|
|
|
|
|
|
|
|
FROM rust:1-slim-buster
|
|
|
|
|
|
|
|
COPY --from=builder /code/target/release/docker_sample /usr/bin/docker_sample
|
2020-02-24 18:48:04 +01:00
|
|
|
|
|
|
|
EXPOSE 5000
|
|
|
|
|
2020-05-27 22:01:26 +02:00
|
|
|
ENTRYPOINT [ "/usr/bin/docker_sample" ]
|