-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (78 loc) · 3.63 KB
/
Copy pathDockerfile
File metadata and controls
88 lines (78 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# syntax=docker/dockerfile:1
#
# Preppy delivery-pipeline image. Bundles the full external toolchain
# (ImageMagick, KTX-Software, gltfpack, Node) + the Python package with the
# `preview` extra so the default thumbnail is a rendered model preview.
#
# Derived from singularity/preppy.def. Multi-arch (linux/amd64, linux/arm64):
# the KTX-Software .deb is selected per-arch via the buildx-provided TARGETARCH.
ARG BASE_IMAGE=python:3.11-slim
FROM ${BASE_IMAGE}
LABEL org.opencontainers.image.title="Preppy"
LABEL org.opencontainers.image.description="Mesh preparation for DRI Voyager: source OBJs + textures -> web-ready self-contained glb per variant + manifest."
LABEL org.opencontainers.image.authors="Seth Parker <c.seth.parker@uky.edu>"
LABEL org.opencontainers.image.source="https://github.com/educelab/preppy"
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
# TARGETARCH is injected by Docker buildx (amd64 | arm64).
ARG TARGETARCH
ENV DEBIAN_FRONTEND=noninteractive \
# Headless offscreen GL backend for the pyrender model-preview thumbnail.
# (libosmesa6 is installed below; if GL fails on a host the thumbnail falls
# back to a texture crop.)
PYOPENGL_PLATFORM=osmesa \
PIP_NO_CACHE_DIR=1
# System dependencies:
# imagemagick -> texture normalization (magick/mogrify)
# libosmesa6, libgl1 -> offscreen GL for the rendered model-preview thumbnail
# curl/git/gcc/g++/make -> fetch installers + build any sdist-only wheels
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
gcc \
g++ \
git \
make \
tzdata \
imagemagick \
libosmesa6 \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Node.js (24 LTS) for gltfpack and the KTX2 embed helper.
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& node -v
# KTX-Software (provides `ktx create`; `toktx` is not used). The .def targeted a
# v5 that is not yet released as a final tag, so pin the latest stable that ships
# `ktx create` for both amd64 and arm64. Bump when v5.0.0 ships.
# Assets: https://github.com/KhronosGroup/KTX-Software/releases
ARG KTX_VERSION=4.4.2
RUN set -eux; \
case "${TARGETARCH}" in \
amd64) ktx_arch="x86_64" ;; \
arm64) ktx_arch="arm64" ;; \
*) echo "unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
esac; \
curl -fsSL -o /tmp/ktx.deb \
"https://github.com/KhronosGroup/KTX-Software/releases/download/v${KTX_VERSION}/KTX-Software-${KTX_VERSION}-Linux-${ktx_arch}.deb"; \
apt-get update; \
apt-get install -y /tmp/ktx.deb; \
rm -f /tmp/ktx.deb; \
rm -rf /var/lib/apt/lists/*; \
ktx --version
# Node CLI tools: gltfpack (geometry). obj2gltf/gltf-pipeline are the deprecated
# legacy path, kept until it is removed.
RUN npm install -g gltfpack obj2gltf gltf-pipeline
WORKDIR /usr/local/educelab/preppy
COPY . .
# Install the embed helper's npm deps (@gltf-transform/core + meshoptimizer) and
# the Python package with the `preview` extra (trimesh + pyrender). The install
# is editable so the embed helper resolves node_modules relative to the package
# source (assemble.NODE_DIR) — the same reason the .def uses --editable.
RUN npm install --prefix preppy/node \
&& python3 -m pip install --upgrade pip wheel setuptools \
&& python3 -m pip install --editable '.[preview]'
# No restrictive ENTRYPOINT: any console script (preppy, preppy-check-tools,
# preppy-obj2glb, preppy-merge-items) can be used as the command. Bare
# `docker run <image>` prints the pipeline's help.
CMD ["preppy", "-h"]