🛠️ ThingsBoard Custom UI JAR Build Guide (Docker‐Based) - telemetryinsights/thingsboard GitHub Wiki

This document outlines how to build the ThingsBoard UI and backend JAR using Docker, extract the output, and deploy to a Raspberry Pi (or other target device).


🧱 Build Requirements

  • Docker Desktop (with daemon running)
  • Windows PowerShell or Linux shell
  • Internet connection (for Docker image and Maven/Node dependencies)

📁 Directory Structure

Place these files in:

C:\GitHub\ti\thingsboard\docker\
├── Dockerfile
├── build.cmd (Windows)
├── build.sh  (Linux/WSL optional)

📄 Dockerfile

FROM maven:3.8.6-eclipse-temurin-17 as build

# Install Node.js for Angular build
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
    apt-get update && \
    apt-get install -y nodejs

WORKDIR /app
COPY . .

# Prevent Git from defaulting to SSH
RUN git config --global url."https://github.com/".insteadOf "ssh://[email protected]/"

# Build UI
RUN mvn clean install -f ui-ngx/pom.xml -DskipTests -Dlicense.skip=true

# Build backend (Spring Boot JAR)
RUN mvn clean install -f pom.xml -DskipTests -Dlicense.skip=true -pl ui-ngx,application -am

🖥️ Build Script (build.cmd)

@echo off
echo Building ThingsBoard Docker image...
docker build --no-cache -t tb-builder -f Dockerfile ..

✅ Build Steps

  1. Open PowerShell in C:\GitHub\ti\thingsboard\docker

  2. Run the build:

build.cmd
  1. When complete, extract the Spring Boot JAR:
docker create --name tb-build-runner tb-builder
docker cp tb-build-runner:/app/application/target/thingsboard-4.1.0-SNAPSHOT-boot.jar thingsboard.jar
docker rm tb-build-runner

🚀 Deploy to Raspberry Pi

  1. Upload to Pi:
sftp [email protected]
put thingsboard.jar /tmp/
exit
  1. SSH into the Pi:
ssh [email protected]
  1. Replace the existing JAR:
sudo systemctl stop thingsboard
sudo cp /usr/share/thingsboard/bin/thingsboard.jar /usr/share/thingsboard/bin/thingsboard.jar.bak
sudo cp /tmp/thingsboard.jar /usr/share/thingsboard/bin/thingsboard.jar
sudo chown thingsboard:thingsboard /usr/share/thingsboard/bin/thingsboard.jar
sudo systemctl start thingsboard
  1. Verify:
sudo systemctl status thingsboard

🎯 Next Step: CI/CD Pipeline

  • Use GitHub Actions, GitLab CI, or a local Jenkins runner
  • Mount Docker volume to persist Maven/Node cache
  • Push final JAR to an artifact store or directly scp to the target

Let this guide serve as your reproducible foundation for custom ThingsBoard builds and deployment.


Authored by ChatGPT with Stephen Harris 🧠 on the command line.