2020-06-22 00:27:57 +07:00
|
|
|
FROM rust:1.44.1-slim AS base
|
|
|
|
|
|
|
|
ENV USER=root
|
|
|
|
|
2020-06-22 16:25:42 +07:00
|
|
|
WORKDIR /usr/local/src/index/
|
2020-06-22 00:27:57 +07:00
|
|
|
|
|
|
|
RUN cargo init
|
|
|
|
COPY ./Cargo.toml ./Cargo.toml
|
|
|
|
RUN cargo fetch
|
|
|
|
|
|
|
|
COPY ./src/ ./src/
|
|
|
|
|
|
|
|
CMD [ "cargo", "test", "--offline" ]
|
|
|
|
|
|
|
|
FROM base AS builder
|
|
|
|
|
|
|
|
RUN cargo build --release --offline
|
|
|
|
|
|
|
|
FROM rust:1.44.1-slim
|
|
|
|
|
2020-06-22 16:25:42 +07:00
|
|
|
COPY --from=builder /usr/local/src/index/target/release/index /usr/local/bin/index
|
2020-06-22 00:27:57 +07:00
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
2020-06-22 16:25:42 +07:00
|
|
|
ENTRYPOINT [ "/usr/local/bin/index" ]
|