diff --git a/Dockerfile b/Dockerfile index 411a3a7..25be695 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ +# syntax=docker/dockerfile:1.7 + # --- Builder Stage --- FROM ubuntu:22.04 AS builder ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential cmake ninja-build git pkg-config \ + build-essential ccache cmake ninja-build git pkg-config \ libssl-dev zlib1g-dev \ libmariadb-dev libmariadb-dev-compat \ libsqlite3-dev python3 libjsoncpp-dev uuid-dev ca-certificates \ @@ -14,7 +16,10 @@ RUN rm -rf /usr/include/mysql && ln -s /usr/include/mariadb /usr/include/mysql WORKDIR /app COPY . /app -RUN cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ +RUN --mount=type=cache,target=/app/.cache/cpm \ + --mount=type=cache,target=/root/.cache/ccache \ + cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ && cmake --build build # --- Runtime Stage --- diff --git a/README.md b/README.md index 10667df..fab360b 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,9 @@ Set `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `MYSQL_ROOT_PASSWORD` and origin without quotes or a trailing slash, for example `https://visione.studentindipendenti.it`. +Docker builds use BuildKit cache mounts for CPM dependencies and `ccache`, so +repeat Dokploy builds can reuse Drogon and C++ compilation cache. + ## Current Endpoints - `GET /api/v1/health`: process health check, no external dependency.