| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # trunk-ignore-all(trivy/DS002): We must run as root for this container
 | 
					
						
							|  |  |  | # trunk-ignore-all(hadolint/DL3002): We must run as root for this container
 | 
					
						
							| 
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 |  |  | # trunk-ignore-all(hadolint/DL3008): Do not pin apt package versions
 | 
					
						
							|  |  |  | # trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions
 | 
					
						
							| 
									
										
										
										
											2022-11-20 11:57:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-25 12:53:33 +00:00
										 |  |  | FROM python:3.13-bookworm AS builder
 | 
					
						
							| 
									
										
										
										
											2025-04-18 14:29:39 +00:00
										 |  |  | ARG PIO_ENV=native | 
					
						
							| 
									
										
										
										
											2022-11-20 11:57:55 +00:00
										 |  |  | ENV DEBIAN_FRONTEND=noninteractive | 
					
						
							|  |  |  | ENV TZ=Etc/UTC
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # Install Dependencies
 | 
					
						
							|  |  |  | ENV PIP_ROOT_USER_ACTION=ignore | 
					
						
							| 
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 |  |  | RUN apt-get update && apt-get install --no-install-recommends -y \
 | 
					
						
							| 
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 |  |  |         curl wget g++ zip git ca-certificates pkg-config \
 | 
					
						
							| 
									
										
										
										
											2025-03-20 13:47:39 +00:00
										 |  |  |         libgpiod-dev libyaml-cpp-dev libbluetooth-dev libi2c-dev libuv1-dev \
 | 
					
						
							| 
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 |  |  |         libusb-1.0-0-dev libulfius-dev liborcania-dev libssl-dev \
 | 
					
						
							|  |  |  |         libx11-dev libinput-dev libxkbcommon-x11-dev \
 | 
					
						
							| 
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 |  |  |     && apt-get clean && rm -rf /var/lib/apt/lists/* \
 | 
					
						
							|  |  |  |     && pip install --no-cache-dir -U platformio \
 | 
					
						
							|  |  |  |     && mkdir /tmp/firmware
 | 
					
						
							| 
									
										
										
										
											2022-11-06 02:08:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # Copy source code
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | WORKDIR /tmp/firmware
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | COPY . /tmp/firmware
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Build
 | 
					
						
							| 
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 |  |  | RUN bash ./bin/build-native.sh "$PIO_ENV" && \
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  |     cp "/tmp/firmware/release/meshtasticd_linux_$(uname -m)" "/tmp/firmware/release/meshtasticd"
 | 
					
						
							| 
									
										
										
										
											2022-11-20 11:57:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-08 21:14:39 +00:00
										 |  |  | # Fetch web assets
 | 
					
						
							|  |  |  | RUN curl -L "https://github.com/meshtastic/web/releases/download/v$(cat /tmp/firmware/bin/web.version)/build.tar" -o /tmp/web.tar \
 | 
					
						
							|  |  |  |     && mkdir -p /tmp/web \
 | 
					
						
							|  |  |  |     && tar -xf /tmp/web.tar -C /tmp/web/ \
 | 
					
						
							|  |  |  |     && gzip -dr /tmp/web \
 | 
					
						
							|  |  |  |     && rm /tmp/web.tar
 | 
					
						
							| 
									
										
										
										
											2022-11-20 11:57:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | ##### PRODUCTION BUILD #############
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | FROM debian:bookworm-slim
 | 
					
						
							| 
									
										
										
										
											2025-05-15 11:40:46 +00:00
										 |  |  | LABEL org.opencontainers.image.title="Meshtastic" \
 | 
					
						
							|  |  |  |       org.opencontainers.image.description="Debian Meshtastic daemon and web interface" \
 | 
					
						
							|  |  |  |       org.opencontainers.image.url="https://meshtastic.org" \
 | 
					
						
							|  |  |  |       org.opencontainers.image.documentation="https://meshtastic.org/docs/" \
 | 
					
						
							|  |  |  |       org.opencontainers.image.authors="Meshtastic" \
 | 
					
						
							|  |  |  |       org.opencontainers.image.licenses="GPL-3.0-or-later" \
 | 
					
						
							|  |  |  |       org.opencontainers.image.source="https://github.com/meshtastic/firmware/"
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | ENV DEBIAN_FRONTEND=noninteractive | 
					
						
							|  |  |  | ENV TZ=Etc/UTC
 | 
					
						
							| 
									
										
										
										
											2022-11-20 11:57:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # nosemgrep: dockerfile.security.last-user-is-root.last-user-is-root
 | 
					
						
							|  |  |  | USER root
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 |  |  | RUN apt-get update && apt-get --no-install-recommends -y install \
 | 
					
						
							| 
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 |  |  |         libc-bin libc6 libgpiod2 libyaml-cpp0.7 libi2c0 libuv1 libusb-1.0-0-dev \
 | 
					
						
							|  |  |  |         liborcania2.3 libulfius2.7 libssl3 \
 | 
					
						
							|  |  |  |         libx11-6 libinput10 libxkbcommon-x11-0 \
 | 
					
						
							| 
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 |  |  |     && apt-get clean && rm -rf /var/lib/apt/lists/* \
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  |     && mkdir -p /var/lib/meshtasticd \
 | 
					
						
							| 
									
										
										
										
											2025-02-01 08:58:58 +00:00
										 |  |  |     && mkdir -p /etc/meshtasticd/config.d \
 | 
					
						
							|  |  |  |     && mkdir -p /etc/meshtasticd/ssl
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # Fetch compiled binary from the builder
 | 
					
						
							| 
									
										
										
										
											2025-05-15 11:40:46 +00:00
										 |  |  | COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/
 | 
					
						
							| 
									
										
										
										
											2025-04-08 21:14:39 +00:00
										 |  |  | COPY --from=builder /tmp/web /usr/share/meshtasticd/
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # Copy config templates
 | 
					
						
							|  |  |  | COPY ./bin/config.d /etc/meshtasticd/available.d
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | WORKDIR /var/lib/meshtasticd
 | 
					
						
							|  |  |  | VOLUME /var/lib/meshtasticd
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-26 18:59:26 +00:00
										 |  |  | # Expose Meshtastic TCP API port from the host
 | 
					
						
							|  |  |  | EXPOSE 4403
 | 
					
						
							| 
									
										
										
										
											2025-04-08 21:14:39 +00:00
										 |  |  | # Expose Meshtastic Web UI port from the host
 | 
					
						
							| 
									
										
										
										
											2025-05-15 11:40:46 +00:00
										 |  |  | EXPOSE 9443
 | 
					
						
							| 
									
										
										
										
											2024-04-06 15:32:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-15 11:40:46 +00:00
										 |  |  | CMD [ "sh", "-cx", "meshtasticd --fsdir=/var/lib/meshtasticd" ]
 | 
					
						
							| 
									
										
										
										
											2022-11-20 11:57:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-08 21:14:39 +00:00
										 |  |  | HEALTHCHECK NONE
 |