FROM node:20-alpine AS build ARG GIT_REF=master # Install build dependencies RUN apk add --no-cache git cmake alpine-sdk dbus-dev && npm install -g typescript # Clone the repository using GIT_REF (tag or branch) WORKDIR /src RUN git clone --recurse-submodules https://github.com/Affirmatech/MeshSense.git . && \ git checkout "${GIT_REF}" # Web Bluetooth build WORKDIR /src/api/webbluetooth RUN npm install \ && npm run build:all # Meshtastic JS build WORKDIR /src/api/meshtastic-js RUN npm install \ && npm run build # Install main API and UI dependencies WORKDIR /src/ui RUN npm install WORKDIR /src/api RUN npm install # Build UI and API WORKDIR /src/ui RUN npm run build WORKDIR /src/api RUN npm run build # Final image FROM alpine:latest WORKDIR /app RUN apk add --no-cache nodejs dbus-dev # Copy built output COPY --from=build /src/api/dist /app CMD ["node", "index.cjs"]