# syntax=docker/dockerfile:1.7 ARG RUSTC_VERSION=nightly-2025-01-21 FROM clux/muslrust:${RUSTC_VERSION} AS build RUN rustup component add rust-src WORKDIR /source RUN cargo new locus WORKDIR /source/locus COPY amenadiel/ ./amenadiel/ COPY Cargo.toml Cargo.lock ./ RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ cargo build --release -Zbuild-std COPY .git ./.git COPY content ./content COPY src ./src COPY build.rs ./build.rs COPY yarte.toml ./yarte.toml RUN find ./content -name "*.DS_Store" -delete RUN --mount=type=cache,target=/root/.cargo/registry \ --mount=type=cache,target=/root/.cargo/git \ cargo build --release --bin locus RUN set -eux; \ bin_path="$(find /source/locus/target -type f -path '*/release/locus' | head -n 1)"; \ test -n "${bin_path}"; \ strip -s "${bin_path}"; \ cp "${bin_path}" /source/locus/locus RUN strip -s /source/locus/locus RUN mkdir /new_tmp FROM scratch AS runtime WORKDIR /locus COPY --from=build /source/locus/locus ./locus COPY --from=build /source/locus/content ./content COPY --from=build /new_tmp /tmp EXPOSE 1965 ENTRYPOINT ["./locus"]