FROM rust:1.96.1-alpine3.24 AS source RUN apk add --no-cache musl-dev WORKDIR /src COPY Cargo.toml Cargo.lock ./ COPY config.example.toml ./ COPY src ./src COPY static ./static FROM source AS tester RUN cargo test --locked --all-targets FROM source AS builder RUN cargo build --locked --release FROM scratch LABEL org.opencontainers.image.title="ushort" \ org.opencontainers.image.description="Self-contained URL shortener" \ org.opencontainers.image.source="https://git.xcel.me/cabbage/ushort" WORKDIR /app COPY --from=builder --chmod=0555 /src/target/release/ushort /ushort USER 65532:65532 EXPOSE 8080 ENTRYPOINT ["/ushort"] CMD ["/app/config.toml"]