uast 1.4.3

UAST in Rust 🦀
FROM rust:alpine AS build
WORKDIR /app

RUN apk add --no-cache make

# Build the application.
# Leverage a cache mount to /usr/local/cargo/registry/
# for downloaded dependencies, a cache mount to /usr/local/cargo/git/db
# for git repository dependencies, and a cache mount to /app/target/ for
# compiled dependencies which will speed up subsequent builds.
# Leverage a bind mount to the src directory to avoid having to copy the
# source code into the container. Once built, copy the executable to an
# output directory before the cache mounted /app/target is unmounted.
RUN --mount=type=bind,source=src,target=src \
    --mount=type=bind,source=Cargo.toml,target=Cargo.toml \
    --mount=type=bind,source=Cargo.lock,target=Cargo.lock \
    --mount=type=bind,source=Makefile,target=Makefile \
    make && \
    cp ./target/release/uast /bin/uast

FROM scratch AS final

# Copy the executable from the "build" stage.
COPY --from=build /bin/uast /bin/

# What the container should run when it is started.
CMD ["/bin/uast"]