FROM rust:alpine AS builder

COPY Cargo.toml Cargo.lock /app/
COPY src /app/src
WORKDIR /app
RUN apk add musl-dev
RUN cargo build --release

FROM alpine
RUN apk add --no-cache tini
COPY --from=builder /app/target/release/webring /webring
COPY public /public

ENTRYPOINT [ "/sbin/tini", "--", "/webring" ]