From a68995877a9900d23f2f78c1b1f24de09c045bb3 Mon Sep 17 00:00:00 2001 From: iripiri Date: Thu, 26 Jun 2025 09:10:05 +0200 Subject: [PATCH] fix Dockerfile to build and install executable Signed-off-by: iripiri --- Dockerfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index f11ea2a..d9e6d08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,15 +4,20 @@ FROM python:3.11 AS builder WORKDIR /build COPY . . -RUN pip install . +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential gcc python3-dev pkg-config && \ + rm -rf /var/lib/apt/lists/* && \ + pip install --upgrade pip setuptools wheel build -RUN python3 setup.py sdist && \ - pip install dist/*.tar.gz --target /install +RUN python -m build && \ + pip install dist/*.tar.gz --prefix=/install -# minimal runtime image +# runtime stage FROM python:3.11-slim AS runtime -COPY --from=builder /install /usr/local/lib/python3.11/site-packages +# copy installed Python libs + CLI scripts +COPY --from=builder /install /usr/local + COPY etc/*.json etc/*.yaml /etc/villas/controller/ COPY villas-controller.service /etc/systemd/system/