-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile.e2e
More file actions
74 lines (62 loc) · 3.33 KB
/
Copy pathDockerfile.e2e
File metadata and controls
74 lines (62 loc) · 3.33 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
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# System deps for Tauri v2 Linux build + headless rendering
RUN apt-get update && apt-get install -y \
build-essential pkg-config \
libgtk-3-dev libwebkit2gtk-4.1-dev \
libglib2.0-dev libcairo2-dev libpango1.0-dev \
libgdk-pixbuf-2.0-dev libatk1.0-dev libsoup-3.0-dev \
libssl-dev libx11-dev libxkbcommon-dev \
libjavascriptcoregtk-4.1-dev librsvg2-dev \
webkit2gtk-driver \
xvfb curl git unzip \
&& rm -rf /var/lib/apt/lists/*
# Chrome + matching chromedriver, for the web-serve suite (wdio.web.conf.ts).
RUN curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/chrome.deb \
&& apt-get update && apt-get install -y /tmp/chrome.deb \
&& rm /tmp/chrome.deb && rm -rf /var/lib/apt/lists/* \
&& CHROME_VER="$(google-chrome --version | grep -oE '[0-9]+(\.[0-9]+){3}')" \
&& curl -fsSL "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VER}/linux64/chromedriver-linux64.zip" -o /tmp/cd.zip \
&& unzip -j /tmp/cd.zip chromedriver-linux64/chromedriver -d /usr/local/bin \
&& rm /tmp/cd.zip && chromedriver --version
# Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Node version from .nvmrc (must be a bare major -- it feeds the NodeSource setup URL)
COPY .nvmrc /tmp/.nvmrc
RUN curl -fsSL "https://deb.nodesource.com/setup_$(cat /tmp/.nvmrc).x" | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Tauri CLI + WebDriver bridge
RUN cargo install tauri-cli tauri-driver
WORKDIR /repo
# JS deps (cached layer -- only re-runs if package files change)
COPY app/package.json app/package-lock.json ./app/
RUN cd app && npm ci
# Copy source (repo root -- needed for plugins/ dir referenced by build scripts)
COPY app/ ./app/
COPY plugins/ ./plugins/
COPY scripts/internal/ ./scripts/internal/
RUN chmod +x ./scripts/internal/*.sh
WORKDIR /repo/app
# One binary serving both suites: `e2e` adds the WebDriver bridge (desktop),
# `web-serve` adds the `--serve` HTTP sidecar (browser). Neither affects the other.
# A /usr/local/bin exe resolves `res://` to /usr/local/lib/<productName>, so the bundled
# procedures are copied there (tauri-build only stages resources inside target/).
#
# Debug by default: the suite only needs correct behaviour and debug builds fast. A
# benchmark needs `MMA_E2E_PROFILE=release`, because a debug binary handicaps only the
# Rust side -- the webview's JavaScript is JIT-compiled either way, so a debug build
# measures an unoptimised interpreter against optimised JS.
ARG MMA_E2E_PROFILE=debug
# Read back by scripts/e2e.sh so a benchmark records the profile it actually ran on.
LABEL mma.profile=$MMA_E2E_PROFILE
RUN --mount=type=cache,target=/repo/app/src-tauri/target \
--mount=type=cache,target=/root/.cargo/registry \
if [ "$MMA_E2E_PROFILE" = "release" ]; then FLAG=; else FLAG=--debug; fi \
&& cargo tauri build $FLAG --features e2e,web-serve --no-bundle \
&& cp "src-tauri/target/$MMA_E2E_PROFILE/map-making-app" /usr/local/bin/map-making-app \
&& mkdir -p "/usr/local/lib/Map Making App" \
&& if [ -d src-tauri/procedures ]; then cp -r src-tauri/procedures "/usr/local/lib/Map Making App/"; fi
# Start Xvfb + tauri-driver, then run tests
CMD ["/repo/scripts/internal/e2e-native.sh"]