2024-12-26 19:00:50 +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/DL3018): Do not pin apk package versions
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# trunk-ignore-all(hadolint/DL3013): Do not pin pip package versions
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-26 19:00:50 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-07 21:49:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								FROM python:3.13-alpine3.22 AS builder
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 14:29:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ARG PIO_ENV=native
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-26 19:00:50 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ENV PIP_ROOT_USER_ACTION=ignore
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 14:29:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN apk --no-cache add \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        bash g++ libstdc++-dev linux-headers zip git ca-certificates libgpiod-dev yaml-cpp-dev bluez-dev \
							 | 
						
					
						
							
								
									
										
										
										
											2025-03-20 13:47:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        libusb-dev i2c-tools-dev libuv-dev openssl-dev pkgconf argp-standalone \
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        libx11-dev libinput-dev libxkbcommon-dev \
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    && rm -rf /var/cache/apk/* \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    && pip install --no-cache-dir -U platformio \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    && mkdir /tmp/firmware
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-26 19:00:50 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WORKDIR /tmp/firmware
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								COPY . /tmp/firmware
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Create small package (no debugging symbols)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Add `argp` for musl
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ENV PLATFORMIO_BUILD_FLAGS="-Os -ffunction-sections -fdata-sections -Wl,--gc-sections -largp"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN bash ./bin/build-native.sh "$PIO_ENV" && \
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-26 19:00:50 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    cp "/tmp/firmware/release/meshtasticd_linux_$(uname -m)" "/tmp/firmware/release/meshtasticd"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# ##### PRODUCTION BUILD #############
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-06-07 21:49:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								FROM alpine:3.22
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-15 11:40:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								LABEL org.opencontainers.image.title="Meshtastic" \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      org.opencontainers.image.description="Alpine Meshtastic daemon" \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      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-12-26 19:00:50 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# nosemgrep: dockerfile.security.last-user-is-root.last-user-is-root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								USER root
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN apk --no-cache add \
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-15 11:40:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        shadow libstdc++ libgpiod yaml-cpp libusb i2c-tools libuv \
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 12:27:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        libx11 libinput libxkbcommon \
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-25 08:41:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    && rm -rf /var/cache/apk/* \
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-26 19:00:50 +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
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-19 04:29:59 +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-19 04:29:59 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Copy config templates
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								COPY ./bin/config.d /etc/meshtasticd/available.d
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-26 19:00:50 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WORKDIR /var/lib/meshtasticd
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								VOLUME /var/lib/meshtasticd
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								EXPOSE 4403
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CMD [ "sh",  "-cx", "meshtasticd --fsdir=/var/lib/meshtasticd" ]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HEALTHCHECK NONE
							 |