# Build
FROM rust as builder
WORKDIR app
COPY . .
RUN cargo build --release --bin nexus_v7

# Generate
FROM rust as generate
WORKDIR app
COPY --from=builder /app/target/release/nexus_v7 nexus_v7
COPY --from=builder /app/templates templates
COPY --from=builder /app/raws raws
RUN ./nexus_v7

# Serve
FROM nginx as serve
COPY --from=generate /app/generated/ /usr/share/nginx/html
COPY --from=builder /app/resources/ /usr/share/nginx/html