forked from open-gsd/gsd-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (76 loc) · 4.15 KB
/
Copy pathDockerfile
File metadata and controls
90 lines (76 loc) · 4.15 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
89
90
# Open GSD - Docker images
# File Purpose: Define runtime and CI builder container images.
# ──────────────────────────────────────────────
# CI Builder
# Image: ghcr.io/open-gsd/gsd-ci-builder
# Used by: publish workflows that need Rust and Linux cross-compilers
# ──────────────────────────────────────────────
FROM node:24-bookworm AS builder
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
ENV PATH="/root/.cargo/bin:${PATH}"
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
&& rustup target add aarch64-unknown-linux-gnu \
&& rm -rf /var/lib/apt/lists/*
RUN node --version && rustc --version && cargo --version
# ──────────────────────────────────────────────
# Runtime
# Image: ghcr.io/open-gsd/gsd-pi
# Used by: end users via docker run
# ──────────────────────────────────────────────
FROM node:24-slim AS runtime
# Git is required for GSD's git operations
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
# Install GSD globally — version is controlled by the build arg
ARG GSD_VERSION=latest
RUN npm install -g @opengsd/gsd-pi@${GSD_VERSION}
# Default working directory for user projects
WORKDIR /workspace
ENTRYPOINT ["gsd"]
CMD ["--help"]
# ──────────────────────────────────────────────
# Runtime (local build)
# Image: ghcr.io/open-gsd/gsd-pi:local
# Used by: PR-time e2e smoke, builds the *current source* into an image
# instead of pulling from npm. Lets `tests/e2e/docker/` exercise the actual
# runtime container produced by this branch's code.
# Build with: docker build --target runtime-local \
# --build-arg TARBALL=opengsd-gsd-pi-<version>.tgz -t gsd-pi:local .
# The tarball must be in the build context (created by `npm pack`).
# ──────────────────────────────────────────────
FROM node:24-slim AS runtime-local
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
ARG TARBALL
COPY ${TARBALL} /tmp/gsd-pi.tgz
# Install with --ignore-scripts: postinstall is unnecessary for the
# version / help smoke this image is built for, and skipping it removes
# a class of network-dependent failures.
#
# Diagnostic output: list /usr/local/bin and the installed package layout
# so a regression here fails loudly at build time with the actual file
# state visible in CI logs (instead of silently producing an image that
# fails at run time with exit 127 / command not found).
#
# Verify the loader is invokable. We pin to `node /path/to/loader.js`
# (not the bin shim) because the npm bin shim is fragile against npm
# prefix drift inside slim images; running the loader directly always
# works as long as dist/ is in the tarball.
RUN npm install -g --ignore-scripts /tmp/gsd-pi.tgz \
&& rm /tmp/gsd-pi.tgz \
&& echo "--- /usr/local/bin ---" \
&& ls -la /usr/local/bin | grep -i gsd || echo "(no gsd entries in /usr/local/bin)" \
&& echo "--- /usr/local/lib/node_modules/@opengsd/gsd-pi ---" \
&& ls -la /usr/local/lib/node_modules/@opengsd/gsd-pi 2>/dev/null | head -10 \
&& test -f /usr/local/lib/node_modules/@opengsd/gsd-pi/dist/loader.js \
&& node /usr/local/lib/node_modules/@opengsd/gsd-pi/dist/loader.js --version
WORKDIR /workspace
# Invoke the loader directly. Avoids any dependency on the npm bin shim
# being placed correctly in /usr/local/bin (which is platform/prefix
# dependent and has been the source of spurious exit-127 failures).
ENTRYPOINT ["node", "/usr/local/lib/node_modules/@opengsd/gsd-pi/dist/loader.js"]
CMD ["--help"]