``update Add Docker build and deployment workflow for CMS and Ionic Mobile, update docker-compose.yml with new service images, and enhance documentation with strategy diagram and endpoint table``

This commit is contained in:
2025-05-24 08:21:33 +08:00
parent 1157bf0fda
commit cb8643b405
16 changed files with 462 additions and 85 deletions

View File

@@ -0,0 +1,40 @@
# Ignore all files and directories by default
-
# Except for the following:
!.dockerignore
!.gitignore
!.env.example
!.git/
!.env
!.vscode/
!.idea/
# Node.js specific
node_modules/
# Build artifacts
dist/
build/
# Logs
logs/
\*.log
# Environment files
.env\*
# Cache files
\*.cache
# OS generated files
.DS_Store
Thumbs.db

View File

@@ -4,11 +4,14 @@ FROM node:22-slim
# Install pnpm globally
RUN npm install -g pnpm
# Copy your application code (optional, comment out if not needed)
COPY . /app
RUN cd /app && pnpm i
RUN cd /app && pnpm run build
# Set working directory
WORKDIR /app
# Copy your application code (optional, comment out if not needed)
# COPY . .
# Default command (optional)
CMD ["node"]
CMD ["./scripts/docker/entrypoint.sh"]

View File

@@ -10,7 +10,10 @@
"dev": "next dev -H 0.0.0.0",
"build": "next build",
"build:w": "pnpx nodemon --ext ts,tsx,json,mjs,js,jsx --delay 15 --exec \"pnpm run build\"",
"start": "next start",
"docker:push": "docker push 192.168.10.61:5000/demo_ls_cms ",
"docker:build": "docker build -t 192.168.10.61:5000/demo_ls_cms .",
"build:docker": "pnpm run build && pnpm run docker:build && pnpm run docker:push",
"start": "next start -H 0.0.0.0",
"lint": "next lint --quiet",
"lint:fix": "next lint --fix",
"lint:w": "pnpx nodemon --ext ts,tsx,json,mjs,js,jsx --delay 5 --exec \"pnpm run lint\"",
@@ -117,4 +120,4 @@
"protobufjs"
]
}
}
}

View File

@@ -4,9 +4,10 @@ set -ex
reset
rm -rf .next
# rm -rf .next
# pnpm run typecheck
# pnpm run lint:w
# pnpm run lint
# echo "check ok"
pnpm run build

View File

@@ -1,22 +1,14 @@
#!/usr/bin/env bash
# set -x
# nvm use 20
# pnpm run build
pnpm i
pnpm run build
echo "build done"
set -x
while true; do
pnpm run start
echo "server restarted"
echo "command restarted"
sleep 5
sleep 3
done
# pnpm i -D

View File

@@ -1,6 +1,10 @@
import PocketBase from 'pocketbase';
if (!process.env.NEXT_PUBLIC_POCKETBASE_URL) throw new Error('the pocketbase url cannot empty');
if (process.env.NEXT_PUBLIC_POCKETBASE_URL) {
console.log(process.env.NEXT_PUBLIC_POCKETBASE_URL);
} else {
throw new Error('the pocketbase url cannot empty');
}
export const POCKETBASE_URL: string = process.env.NEXT_PUBLIC_POCKETBASE_URL;
export const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL);