FROM rust:1.79 as compile

WORKDIR /build

COPY . .

RUN rustup target add x86_64-unknown-linux-musl

RUN rm -Rf /build/Cargo.lock
RUN cargo update
RUN cargo build --release

RUN ls /build/target

FROM gcr.io/distroless/cc

WORKDIR /app

COPY --from=compile /build/target/release/iwakura-web /app/
COPY --from=compile /build/assets /app/assets
COPY --from=compile /build/templates /app/templates

CMD ["/app/iwakura-web"]
