automate node version
All checks were successful
Deploy to Server / deploy (push) Successful in 1m26s
All checks were successful
Deploy to Server / deploy (push) Successful in 1m26s
This commit is contained in:
@@ -41,6 +41,11 @@ jobs:
|
|||||||
# Note: Changed 'onedev' to 'origin'. Update if your Gitea remote is named differently.
|
# Note: Changed 'onedev' to 'origin'. Update if your Gitea remote is named differently.
|
||||||
git pull origin main
|
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..."
|
echo "==> Running Build..."
|
||||||
# If this build fails, 'set -e' aborts the script instantly.
|
# If this build fails, 'set -e' aborts the script instantly.
|
||||||
# Your existing containers will NOT be touched, keeping the site up.
|
# Your existing containers will NOT be touched, keeping the site up.
|
||||||
|
|||||||
15
.github/workflows/deploy.yml
vendored
15
.github/workflows/deploy.yml
vendored
@@ -10,14 +10,21 @@ jobs:
|
|||||||
- name: Pull latest
|
- name: Pull latest
|
||||||
run: git -C /home/adipu/LabWise pull
|
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
|
- name: Install dependencies
|
||||||
env:
|
|
||||||
PATH: /home/adipu/.local/node20/bin:/usr/bin:/bin
|
|
||||||
run: |
|
run: |
|
||||||
npm install --prefix /home/adipu/LabWise/server
|
npm install --prefix /home/adipu/LabWise/server
|
||||||
npm audit fix --prefix /home/adipu/LabWise/server
|
|
||||||
npm install --prefix /home/adipu/LabWise
|
npm install --prefix /home/adipu/LabWise
|
||||||
npm audit fix --prefix /home/adipu/LabWise
|
|
||||||
|
|
||||||
- name: Restart app
|
- name: Restart app
|
||||||
run: XDG_RUNTIME_DIR=/run/user/1000 systemctl --user restart labwise-app
|
run: XDG_RUNTIME_DIR=/run/user/1000 systemctl --user restart labwise-app
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -32,8 +32,6 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
.claude/
|
.claude/
|
||||||
uploads/
|
uploads/
|
||||||
|
|
||||||
|
|||||||
1
.node-version
Normal file
1
.node-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
25.2.1
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
# ---- Build stage ----
|
ARG NODE_VERSION=25-alpine
|
||||||
FROM node:22-alpine AS builder
|
FROM node:${NODE_VERSION} AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY server/package.json server/package-lock.json* ./
|
COPY server/package.json server/package-lock.json* ./
|
||||||
RUN npm install && npm audit fix
|
RUN npm install
|
||||||
COPY server/src ./src
|
COPY server/src ./src
|
||||||
COPY server/tsconfig.json ./
|
COPY server/tsconfig.json ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ---- Runtime stage ----
|
# ---- Runtime stage ----
|
||||||
FROM node:22-alpine
|
FROM node:${NODE_VERSION}
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
# schema.sql is read by the migrate script at runtime
|
# schema.sql is read by the migrate script at runtime
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# ---- Build stage ----
|
ARG NODE_VERSION=25-alpine
|
||||||
FROM node:22-alpine AS builder
|
FROM node:${NODE_VERSION} AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
RUN npm install && npm audit fix
|
RUN npm install
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npx vite build
|
RUN npx vite build
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.backend
|
dockerfile: Dockerfile.backend
|
||||||
|
args:
|
||||||
|
- NODE_VERSION=${NODE_VERSION:-25-alpine}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# Reads all vars from server/.env, then overrides the two that differ in Docker
|
# Reads all vars from server/.env, then overrides the two that differ in Docker
|
||||||
env_file: ./server/.env
|
env_file: ./server/.env
|
||||||
@@ -43,6 +45,8 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.frontend
|
dockerfile: Dockerfile.frontend
|
||||||
|
args:
|
||||||
|
- NODE_VERSION=${NODE_VERSION:-25-alpine}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "5173:5173"
|
||||||
|
|||||||
6519
package-lock.json
generated
Normal file
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
2805
server/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user