FROM drogonframework/drogon:latest

WORKDIR /app
COPY . /app

# funziona anche senza ma ninja rende il build dell'immagine più veloce
RUN apt-get update && apt-get install -y --no-install-recommends ninja-build \
    && rm -rf /var/lib/apt/lists/*

RUN cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
    && cmake --build build

EXPOSE 5555

RUN chown -R 1000:1000 /app
USER 1000:1000

ENTRYPOINT ["/app/build/visione-backend"]