FROM rust

WORKDIR /usr/src/app

# first cargo files to cache dependencies
COPY Cargo.toml ./
RUN mkdir src && \
    echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \
    cargo build --release
RUN rm -rf src target/release/deps/ixvd_web*

COPY . .
RUN cargo build --release

EXPOSE 8080
CMD ["./target/release/ixvd-web"]