automate node version
All checks were successful
Deploy to Server / deploy (push) Successful in 1m26s

This commit is contained in:
2026-04-24 18:30:10 -05:00
parent 24d126eeb9
commit de2d90f265
9 changed files with 9352 additions and 13 deletions

View File

@@ -41,6 +41,11 @@ jobs:
# Note: Changed 'onedev' to 'origin'. Update if your Gitea remote is named differently.
git pull origin main
echo "==> Updating Node version for Docker..."
NODE_VER=$(cat .node-version)
sed -i '/^NODE_VERSION=/d' .env || true
echo "NODE_VERSION=${NODE_VER}-alpine" >> .env
echo "==> Running Build..."
# If this build fails, 'set -e' aborts the script instantly.
# Your existing containers will NOT be touched, keeping the site up.

View File

@@ -10,14 +10,21 @@ jobs:
- name: Pull latest
run: git -C /home/adipu/LabWise pull
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '/home/adipu/LabWise/.node-version'
- name: Update Docker env with Node version
run: |
NODE_VER=$(cat /home/adipu/LabWise/.node-version)
sed -i '/^NODE_VERSION=/d' /home/adipu/LabWise/.env || true
echo "NODE_VERSION=${NODE_VER}-alpine" >> /home/adipu/LabWise/.env
- name: Install dependencies
env:
PATH: /home/adipu/.local/node20/bin:/usr/bin:/bin
run: |
npm install --prefix /home/adipu/LabWise/server
npm audit fix --prefix /home/adipu/LabWise/server
npm install --prefix /home/adipu/LabWise
npm audit fix --prefix /home/adipu/LabWise
- name: Restart app
run: XDG_RUNTIME_DIR=/run/user/1000 systemctl --user restart labwise-app

2
.gitignore vendored
View File

@@ -32,8 +32,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
.claude/
uploads/

1
.node-version Normal file
View File

@@ -0,0 +1 @@
25.2.1

View File

@@ -1,14 +1,14 @@
# ---- Build stage ----
FROM node:22-alpine AS builder
ARG NODE_VERSION=25-alpine
FROM node:${NODE_VERSION} AS builder
WORKDIR /app
COPY server/package.json server/package-lock.json* ./
RUN npm install && npm audit fix
RUN npm install
COPY server/src ./src
COPY server/tsconfig.json ./
RUN npm run build
# ---- Runtime stage ----
FROM node:22-alpine
FROM node:${NODE_VERSION}
WORKDIR /app
COPY --from=builder /app/dist ./dist
# schema.sql is read by the migrate script at runtime

View File

@@ -1,8 +1,8 @@
# ---- Build stage ----
FROM node:22-alpine AS builder
ARG NODE_VERSION=25-alpine
FROM node:${NODE_VERSION} AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install && npm audit fix
RUN npm install
COPY . .
RUN npx vite build

View File

@@ -22,6 +22,8 @@ services:
build:
context: .
dockerfile: Dockerfile.backend
args:
- NODE_VERSION=${NODE_VERSION:-25-alpine}
restart: unless-stopped
# Reads all vars from server/.env, then overrides the two that differ in Docker
env_file: ./server/.env
@@ -43,6 +45,8 @@ services:
build:
context: .
dockerfile: Dockerfile.frontend
args:
- NODE_VERSION=${NODE_VERSION:-25-alpine}
restart: unless-stopped
ports:
- "5173:5173"

6519
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

2805
server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff