-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
59 lines (51 loc) · 1.89 KB
/
Dockerfile.test
File metadata and controls
59 lines (51 loc) · 1.89 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
# Dockerfile for running mlnative tests with proper library versions
# Provides libjpeg8 and libicu74 needed by maplibre-gl-native
# Uses Node.js because maplibre-gl-native is a V8 native addon
FROM ubuntu:24.04
# Install minimal dependencies + xvfb for headless rendering
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
libjpeg8 \
libicu74 \
libgl1 \
libglx0 \
libopengl0 \
libcurl4 \
libuv1 \
libx11-6 \
libxext6 \
libwebp7 \
libpng16-16t64 \
python3.12 \
python3.12-venv \
unzip \
xvfb \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Install mise and tools (includes node for native module compatibility)
RUN curl https://mise.run | sh
ENV PATH="/root/.local/bin:$PATH"
# Create mise config with Node 22 (ABI 127 has prebuilt maplibre binaries)
RUN echo '[tools]\nuv = "latest"\njust = "latest"\nnode = "22"' > /app/mise.toml
RUN mise trust && mise install
# Copy project files
COPY pyproject.toml Justfile README.md ./
COPY mlnative/ ./mlnative/
COPY examples/ ./examples/
COPY tests/ ./tests/
COPY scripts/ ./scripts/
# Setup Python environment
RUN mise exec -- uv venv && mise exec -- uv pip install -e ".[dev,web]"
# Install native module using npm with explicit postinstall
RUN PLATFORM=$(uname -m | sed 's/x86_64/x64/' | sed 's/aarch64/arm64/') && \
VENDOR_DIR="mlnative/_vendor/linux-${PLATFORM}" && \
rm -rf "${VENDOR_DIR}/node_modules" "${VENDOR_DIR}/package-lock.json" && \
mkdir -p "${VENDOR_DIR}" && \
cd "${VENDOR_DIR}" && \
echo '{"dependencies": {"@maplibre/maplibre-gl-native": "^6.3.0"}}' > package.json && \
mise exec -- npm cache clean --force && \
mise exec -- npm install --prefer-online
# Run tests with Xvfb virtual display
CMD ["sh", "-c", "Xvfb :99 -screen 0 1024x768x24 & export DISPLAY=:99 && sleep 1 && mise exec -- just test"]