2022-03-14 00:16:20 +00:00
|
|
|
FROM rust:1.59 as builder
|
2022-03-14 00:31:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Run dummy build to build and cache dependencies that only depends on Cargo.toml and Cargo.lock
|
|
|
|
WORKDIR /usr/src
|
|
|
|
RUN USER=root cargo new blessed-rs
|
|
|
|
COPY Cargo.toml Cargo.lock /usr/src/blessed-rs/
|
2022-03-14 00:16:20 +00:00
|
|
|
WORKDIR /usr/src/blessed-rs
|
2022-03-14 00:31:44 +00:00
|
|
|
RUN cargo build --release
|
|
|
|
|
|
|
|
# Run actual build
|
2022-03-14 00:16:20 +00:00
|
|
|
COPY ./src ./src
|
|
|
|
COPY ./data ./data
|
2022-03-14 00:31:44 +00:00
|
|
|
RUN cargo build --release
|
2022-03-14 00:16:20 +00:00
|
|
|
|
|
|
|
FROM debian:buster-slim
|
|
|
|
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
|
2022-03-14 00:55:03 +00:00
|
|
|
COPY --from=builder /usr/src/blessed-rs/target/release/blessed-rs /usr/local/bin/blessed-rs
|
2022-03-14 00:16:20 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/blessed-rs
|
|
|
|
COPY ./static ./static
|
|
|
|
COPY ./templates ./templates
|
|
|
|
COPY ./data ./data
|
2022-03-14 00:31:44 +00:00
|
|
|
CMD ["blessed-rs"]
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src
|
|
|
|
|
|
|
|
# Create blank project
|
|
|
|
RUN USER=root cargo new umar
|
|
|
|
|
|
|
|
# We want dependencies cached, so copy those first.
|
|
|
|
COPY Cargo.toml Cargo.lock /usr/src/umar/
|
|
|
|
|
|
|
|
WORKDIR /usr/src/umar
|
|
|
|
|
|
|
|
# This is a dummy build to get the dependencies cached.
|
|
|
|
|
|
|
|
|
|
|
|
# Now copy in the rest of the sources
|
|
|
|
COPY src /usr/src/umar/src/
|
|
|
|
|
|
|
|
# This is the actual build.
|
|
|
|
RUN cargo build --release \
|
|
|
|
&& mv target/release/umar /bin \
|
|
|
|
&& rm -rf /usr/src/umar
|
|
|
|
|
|
|
|
WORKDIR /
|