-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathDockerfile.armv7
More file actions
119 lines (95 loc) · 4.01 KB
/
Copy pathDockerfile.armv7
File metadata and controls
119 lines (95 loc) · 4.01 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Build stage for ARMv7 (Raspberry Pi 2/3 32-bit)
# Node.js 24 doesn't support ARMv7, so we use Node.js 22 LTS
FROM node:22.22.2-bookworm-slim AS builder
WORKDIR /app
# Install build dependencies for native modules
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy package files
COPY package*.json ./
# Install dependencies
# Use npm install instead of npm ci to avoid optional dependency bug
# better-sqlite3 will download pre-built binaries for the target platform
# Use cache mount to speed up repeated builds
# --legacy-peer-deps needed for vitest peer dependency conflicts
#
# PUPPETEER_SKIP_DOWNLOAD=true: puppeteer's npm postinstall downloads a
# Chrome binary, and Chrome has no armv7 build — without this the
# install fails at downloadBrowsers and the whole image build aborts.
# Puppeteer is a devDependency used only by CI tests, so production
# armv7 images don't need the browser binary at all.
RUN --mount=type=cache,target=/root/.npm \
PUPPETEER_SKIP_DOWNLOAD=true \
npm install --legacy-peer-deps
# Verify protobufs are present (fail fast if git submodule wasn't initialized)
# Copy protobufs first as they rarely change
COPY protobufs ./protobufs
RUN if [ ! -f "protobufs/meshtastic/mesh.proto" ]; then \
echo "ERROR: Protobuf files not found! Git submodule may not be initialized."; \
echo "Run: git submodule update --init --recursive"; \
exit 1; \
fi
# Copy config files and source needed for builds
COPY tsconfig.json tsconfig.server.json tsconfig.node.json vite.config.ts index.html embed.html ./
COPY src ./src
COPY public ./public
# Build the React application first (always for root, will be rewritten at runtime)
# Vite clears dist directory, so this must come before server build
RUN --mount=type=cache,target=/app/node_modules/.vite \
npm run build
# Build the server last so it doesn't get overwritten by Vite
# TypeScript server build will add to dist directory without clearing it
RUN --mount=type=cache,target=/app/.tsc-cache \
npm run build:server
# Production stage for ARMv7
FROM node:22.22.2-bookworm-slim
WORKDIR /app
# Install Python and dependencies for Apprise
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
python3-requests \
supervisor \
gosu \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& python3 -m venv /opt/apprise-venv \
&& /opt/apprise-venv/bin/pip install --no-cache-dir apprise "paho-mqtt<2.0"
# Copy package files
COPY package*.json ./
# Copy node_modules from builder (includes compiled native modules)
COPY --from=builder /app/node_modules ./node_modules
# Copy built assets from builder stage
COPY --from=builder /app/dist ./dist
# Copy protobuf definitions needed by the server
COPY --from=builder /app/protobufs ./protobufs
# Fix ownership of dist directory for node user
RUN chown -R node:node ./dist
# Create data directory for SQLite database and Apprise configs
RUN mkdir -p /data/apprise-config /data/scripts && chown -R node:node /data
# Create supervisor configuration to run both Node.js and Apprise
RUN mkdir -p /etc/supervisor/conf.d
COPY docker/supervisord.armv7.conf /etc/supervisord.conf
# Create Apprise API wrapper script
COPY docker/apprise-api.py /app/apprise-api.py
RUN chmod +x /app/apprise-api.py
# Copy and set up entrypoint script
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose ports
# 3001: MeshMonitor Express server
# 8000: Internal Apprise API (not exposed to host by default)
EXPOSE 3001 8000
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3001
ENV APPRISE_CONFIG_DIR=/data/apprise-config
ENV APPRISE_STATEFUL_MODE=simple
# Use entrypoint to deploy scripts before starting supervisor
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# Run supervisor to manage both processes
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]