diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml index d3c37e3..2cc5626 100644 --- a/.github/workflows/mdbook.yml +++ b/.github/workflows/mdbook.yml @@ -26,10 +26,4 @@ jobs: contents: read steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - - - run: make login - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} - - run: make test-build-with-latest diff --git a/Dockerfile b/Dockerfile index 7ee5abf..8117ecb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ +# syntax=docker/dockerfile:1 ARG BASE_IMAGE -FROM rust:1.78-slim-bookworm AS builder +FROM rust:1.78.0-slim-bookworm AS builder ARG TARGETPLATFORM ARG MDBOOK_VERSION @@ -9,18 +10,28 @@ ARG MDBOOK_MERMAID_VERSION ARG MDBOOK_TOC_VERSION ARG MDBOOK_ADMONISH_VERSION -RUN apt-get update && \ +ENV CARGO_TARGET_DIR="/usr/local/cargo-target" + +RUN rm -f /etc/apt/apt.conf.d/docker-clean && \ + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache +RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ + --mount=type=cache,sharing=locked,target=/var/lib/apt \ + apt-get update && \ apt-get install --no-install-recommends -y \ musl-tools \ file RUN rustup target add "${CARGO_TARGET}" -RUN cargo install mdbook --version "${MDBOOK_VERSION}" --target "${CARGO_TARGET}" && \ +RUN --mount=type=cache,sharing=locked,target=/usr/local/cargo-target \ + cargo install mdbook --version "${MDBOOK_VERSION}" --target "${CARGO_TARGET}" && \ strip "$(which mdbook)" -RUN cargo install mdbook-mermaid --version "${MDBOOK_MERMAID_VERSION}" --target "${CARGO_TARGET}" && \ +RUN --mount=type=cache,sharing=locked,target=/usr/local/cargo-target \ + cargo install mdbook-mermaid --version "${MDBOOK_MERMAID_VERSION}" --target "${CARGO_TARGET}" && \ strip "$(which mdbook-mermaid)" -RUN cargo install mdbook-toc --version "${MDBOOK_TOC_VERSION}" --target "${CARGO_TARGET}" && \ +RUN --mount=type=cache,sharing=locked,target=/usr/local/cargo-target \ + cargo install mdbook-toc --version "${MDBOOK_TOC_VERSION}" --target "${CARGO_TARGET}" && \ strip "$(which mdbook-toc)" -RUN cargo install mdbook-admonish --version "${MDBOOK_ADMONISH_VERSION}" --target "${CARGO_TARGET}" && \ +RUN --mount=type=cache,sharing=locked,target=/usr/local/cargo-target \ + cargo install mdbook-admonish --version "${MDBOOK_ADMONISH_VERSION}" --target "${CARGO_TARGET}" && \ strip "$(which mdbook-admonish)" FROM ${BASE_IMAGE} diff --git a/Makefile b/Makefile index 1df0449..608fbaf 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ build-alpine: --cache-from "type=gha,scope=${DOCKER_SCOPE}" \ --cache-to "type=gha,mode=max,scope=${DOCKER_SCOPE}" \ --build-arg MDBOOK_VERSION="${DOCKER_VERSION}" \ - --build-arg BASE_IMAGE="alpine:3.20" \ + --build-arg BASE_IMAGE="alpine:3.20.0" \ --build-arg MDBOOK_MERMAID_VERSION="${MDBOOK_MERMAID_VERSION}" \ --build-arg MDBOOK_TOC_VERSION="${MDBOOK_TOC_VERSION}" \ --build-arg MDBOOK_ADMONISH_VERSION="${MDBOOK_ADMONISH_VERSION}" \ @@ -75,7 +75,7 @@ build-rust: --cache-from "type=gha,scope=${DOCKER_SCOPE}" \ --cache-to "type=gha,mode=max,scope=${DOCKER_SCOPE}" \ --build-arg MDBOOK_VERSION="${DOCKER_VERSION}" \ - --build-arg BASE_IMAGE="rust:1.78-alpine3.20" \ + --build-arg BASE_IMAGE="rust:1.78.0-alpine3.20" \ --build-arg MDBOOK_MERMAID_VERSION="${MDBOOK_MERMAID_VERSION}" \ --build-arg MDBOOK_TOC_VERSION="${MDBOOK_TOC_VERSION}" \ --build-arg MDBOOK_ADMONISH_VERSION="${MDBOOK_ADMONISH_VERSION}" \