From e9e40638de55f60839b1c7bf64baf4ecd12f2f41 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Fri, 16 Aug 2024 13:47:14 -0400 Subject: [PATCH 1/3] try a vanilla debian image --- Dockerfile | 43 ++++++++++++------------------- docker/trimesh-setup | 3 --- examples/docker/render/Dockerfile | 6 +++++ 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index 837854bab..0ff1b91fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,41 @@ -FROM python:3.12-slim-bookworm AS base +# use a vanilla Debian base image +FROM debian:trixie-slim AS base LABEL maintainer="mikedh@kerfed.com" -# Install helper script to PATH. -COPY --chmod=755 docker/trimesh-setup /usr/local/bin/ - # Create a non-root user with `uid=499`. -RUN useradd -m -u 499 -s /bin/bash user +RUN useradd -m -u 499 -s /bin/bash user && \ + apt-get update && \ + apt-get install --no-install-recommends -qq -y python3.12-venv && \ + apt-get clean -y -# Required for Python to be able to find libembree. -ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" +USER user + +WORKDIR /home/user +RUN python3.12 -m venv venv # So scripts installed from pip are in $PATH -ENV PATH="/home/user/.local/bin:$PATH" +ENV PATH="/home/user/venv/bin:$PATH" + +# Install helper script to PATH. +COPY --chmod=755 docker/trimesh-setup /home/user/venv/bin +####################################### ## install things that need building FROM base AS build -# install build essentials for compiling stuff -RUN trimesh-setup --install build - # copy in essential files COPY --chown=499 trimesh/ /home/user/trimesh COPY --chown=499 pyproject.toml /home/user/ -# switch to non-root user -USER user - # install trimesh into .local -RUN pip install --user /home/user[easy] +RUN pip install /home/user[easy] #################################### ### Build output image most things should run on FROM base AS output -# switch to non-root user -USER user -WORKDIR /home/user - # just copy over the results of the compiled packages -COPY --chown=499 --from=build /home/user/.local /home/user/.local - -# Set environment variables for software rendering. -ENV XVFB_WHD="1920x1080x24"\ - DISPLAY=":99" \ - LIBGL_ALWAYS_SOFTWARE="1" \ - GALLIUM_DRIVER="llvmpipe" +COPY --chown=499 --from=build /home/user/venv /home/user/venv ############################### #### Run Unit Tests diff --git a/docker/trimesh-setup b/docker/trimesh-setup index c8eb461ea..ba614dd18 100755 --- a/docker/trimesh-setup +++ b/docker/trimesh-setup @@ -35,7 +35,6 @@ config_json = """ "pandoc" ], "llvmpipe": [ - "libgl1-mesa-glx", "libgl1-mesa-dri", "xvfb", "xauth", @@ -43,8 +42,6 @@ config_json = """ "freeglut3-dev" ], "test": [ - "blender", - "openscad", "curl", "git" ], diff --git a/examples/docker/render/Dockerfile b/examples/docker/render/Dockerfile index a81c76ba6..f6967851d 100644 --- a/examples/docker/render/Dockerfile +++ b/examples/docker/render/Dockerfile @@ -8,6 +8,12 @@ RUN trimesh-setup --install llvmpipe # go back to the unprivileged user USER user +# Set environment variables for software rendering. +ENV XVFB_WHD="1920x1080x24"\ + DISPLAY=":99" \ + LIBGL_ALWAYS_SOFTWARE="1" \ + GALLIUM_DRIVER="llvmpipe" + # copy our example file which renders a sphere COPY render.py . From 7e71b63eca52d3752fdeec09c70bb9dc4f504f51 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Mon, 19 Aug 2024 15:54:56 -0400 Subject: [PATCH 2/3] switch to bpy.ops.wm --- trimesh/resources/templates/blender_boolean.py.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trimesh/resources/templates/blender_boolean.py.tmpl b/trimesh/resources/templates/blender_boolean.py.tmpl index 78096868e..209c6caf9 100644 --- a/trimesh/resources/templates/blender_boolean.py.tmpl +++ b/trimesh/resources/templates/blender_boolean.py.tmpl @@ -40,7 +40,7 @@ if __name__ == '__main__': mesh_post = os.path.abspath(r'$MESH_POST') for filename in mesh_pre: # use data.objects instead of context.scene.objects - bpy.ops.import_mesh.stl(filepath=os.path.abspath(filename)) + bpy.ops.wm.stl_import(filepath=os.path.abspath(filename)) mesh = bpy.data.objects[0] # Make sure mesh is the active object @@ -62,6 +62,6 @@ if __name__ == '__main__': bpy.ops.object.modifier_apply(modifier=mod.name) delete_nonresult(bpy) - bpy.ops.export_mesh.stl( + bpy.ops.wm.stl_export( filepath=mesh_post, - use_mesh_modifiers=True) + apply_modifiers=True) From e4ed1cab5c875215fba29c0d73226bb8c1a909f2 Mon Sep 17 00:00:00 2001 From: Michael Dawson-Haggerty Date: Tue, 20 Aug 2024 13:59:13 -0400 Subject: [PATCH 3/3] version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fc3047bfa..8c318df72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"] [project] name = "trimesh" requires-python = ">=3.8" -version = "4.4.6" +version = "4.4.7" authors = [{name = "Michael Dawson-Haggerty", email = "mikedh@kerfed.com"}] license = {file = "LICENSE.md"} description = "Import, export, process, analyze and view triangular meshes."