tirocinio-canali-steffo-acrate/acrate_docker/Dockerfile

33 lines
1.2 KiB
Text
Raw Normal View History

FROM rust AS base_builder
WORKDIR /usr/src/acrate
COPY --from=source ./acrate_database ./acrate_database
COPY --from=source ./acrate_nodeinfo ./acrate_nodeinfo
COPY --from=source ./acrate_rd ./acrate_rd
COPY --from=source ./acrate_rdserver ./acrate_rdserver
COPY --from=source ./Cargo.toml ./Cargo.toml
COPY --from=source ./Cargo.lock ./Cargo.lock
FROM rust:slim AS base_runner
RUN apt-get update
RUN apt-get upgrade --assume-yes
RUN apt-get install --assume-yes libpq5
WORKDIR /usr/local/bin
ENV RUST_LOG="warn"
FROM base_builder AS migrate_build
RUN cargo build --release --package=acrate_database --features=bin --bin=acrate_database_migrate
FROM base_runner AS migrate
COPY --from=migrate_build /usr/src/acrate/target/release/acrate_database_migrate /usr/local/bin/acrate_database_migrate
ENTRYPOINT ["acrate_database_migrate"]
ENV RUST_LOG="warn,acrate_database_migrate=info"
FROM base_builder AS rdserver_build
RUN cargo build --release --package=acrate_rdserver --bin=acrate_rdserver
FROM base_runner AS rdserver
COPY --from=rdserver_build /usr/src/acrate/target/release/acrate_rdserver /usr/local/bin/acrate_rdserver
ENTRYPOINT ["acrate_rdserver"]
HEALTHCHECK CMD ["curl", "http://127.0.0.1/.healthcheck"]
ENV RUST_LOG="warn,acrate_rdserver=info"