From 90a4ff855311632a60c3d07049ca7399307e9d7e Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Mon, 12 Feb 2024 07:33:29 +0000 Subject: [PATCH] fix Dockerfile runtime --- .dockerignore | 3 +++ .github/workflows/_test.yml | 2 +- Dockerfile | 14 +++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1f491d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +README.md +tests\** diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 5bacee1..636dd61 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -16,7 +16,7 @@ on: env: # https://github.com/pytest-dev/pytest/issues/2042 PY_IGNORE_IMPORTMISMATCH: "1" - ENV QT_QPA_PLATFORM: offscreen + QT_QPA_PLATFORM: offscreen jobs: run: diff --git a/Dockerfile b/Dockerfile index 9fdf561..66a6fbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,15 @@ # The devcontainer should use the developer target and run as root with podman # or docker with user namespaces. ARG PYTHON_VERSION=3.11 -FROM python:${PYTHON_VERSION} as system +FROM python:${PYTHON_VERSION} as developer -# Add any system dependencies for developer and runtime targets +# Add any system dependencies for the developer/build environment here RUN apt-get update && apt-get install -y --no-install-recommends \ graphviz \ + libglib2.0-0 \ libqt5gui5 libxcb-xinerama0 \ && rm -rf /var/lib/apt/lists/* -FROM system as developer - # Set up a virtual environment and put it in PATH RUN python -m venv /venv ENV PATH=/venv/bin:$PATH @@ -25,11 +24,16 @@ RUN pip install . # The runtime stage copies the built venv into a slim runtime container FROM python:${PYTHON_VERSION}-slim as runtime + # Add apt-get system dependecies for runtime here if needed +RUN apt-get update && apt-get install -y --no-install-recommends \ + libqt5gui5 libxcb-xinerama0 \ + && rm -rf /var/lib/apt/lists/* + COPY --from=build /venv/ /venv/ ENV PATH=/venv/bin:$PATH # change this entrypoint if it is not the same as the repo ENTRYPOINT ["dls-pmac-control"] -CMD ["--version"] +