From 9c0f8c470bb2ce6485e5f3a22b87ae66d2c19352 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 3 Jul 2025 19:52:59 -0400 Subject: [PATCH] update Dockerfile, build nightly --- .gitea/workflows/nightly-build.yml | 20 +++++++++++ Dockerfile | 56 ++++++++++++++++++++++-------- 2 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 .gitea/workflows/nightly-build.yml diff --git a/.gitea/workflows/nightly-build.yml b/.gitea/workflows/nightly-build.yml new file mode 100644 index 0000000..45251cc --- /dev/null +++ b/.gitea/workflows/nightly-build.yml @@ -0,0 +1,20 @@ +name: Nightly Docker Build + +on: + push: + schedule: + - cron: '0 0 * * *' # Midnight + workflow_dispatch: # Allow manual runs + +jobs: + build-and-push: + runs-on: alpine:latest + steps: + - name: Install dependencies + run: apk add docker nodejs + - name: Login to Docker registry + run: docker login git.arinity.org -u matt -p "${{ secrets.DOCKER_PUSH_TOKEN }}" + - name: Checkout repository + uses: actions/checkout@v4 + - name: Build & Push Docker image + run: docker build --push --no-cache -t git.arinity.org/meshsense-tools/meshsense:nightly . diff --git a/Dockerfile b/Dockerfile index ee5f5ee..10ad280 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,46 @@ -FROM alpine:latest AS build -ARG GIT_REF="main" -WORKDIR /src -RUN apk add git cmake nodejs npm alpine-sdk dbus-dev -COPY . . -#RUN git clone --recurse-submodules --branch ${GIT_REF} https://github.com/Affirmatech/MeshSense.git . -# Web Bluetooth -RUN cd api/webbluetooth && npm i && npm run build:all -# Meshtastic JS -RUN cd api/meshtastic-js && npm i && npm run build -# Install dependencies -RUN cd ui && npm i && cd ../api && npm i -# Build -RUN cd ui && npm run build && cd ../api && npm run build +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 nodejs dbus-dev +RUN apk add --no-cache nodejs dbus-dev + +# Copy built output COPY --from=build /src/api/dist /app + CMD ["node", "index.cjs"]