mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 13:35:12 +09:00
- Add APP_NAME as automatic variable for all template installs
- Handle both list and dict formats for template variables
- Update uptime-kuma, portainer, node-app templates with proper format
- Use ${APP_NAME} for container names instead of hardcoded values
- Standardize port variable names to HTTP_PORT
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
80 lines
1.8 KiB
YAML
80 lines
1.8 KiB
YAML
id: node-app
|
|
name: Node.js Application
|
|
version: "20"
|
|
description: Custom Node.js application. Supports Node 18-21. Perfect for Express, Next.js, or any Node.js project.
|
|
icon: https://nodejs.org/static/logos/nodejsLight.svg
|
|
website: https://nodejs.org
|
|
documentation: https://nodejs.org/docs/
|
|
categories:
|
|
- development
|
|
- api
|
|
- custom
|
|
|
|
variables:
|
|
- name: HTTP_PORT
|
|
description: HTTP port for the application (auto-assigned if not specified)
|
|
type: port
|
|
default: "8300"
|
|
- name: NODE_VERSION
|
|
description: Node.js version (18, 20, 21)
|
|
type: string
|
|
default: "20"
|
|
|
|
ports:
|
|
- port: "${HTTP_PORT}"
|
|
protocol: tcp
|
|
description: Web interface
|
|
|
|
volumes:
|
|
- name: app
|
|
path: /app
|
|
description: Application files (put your Node.js code here)
|
|
|
|
requirements:
|
|
memory: 256MB
|
|
storage: 1GB
|
|
|
|
compose:
|
|
services:
|
|
app:
|
|
image: node:${NODE_VERSION:-20}-alpine
|
|
container_name: ${APP_NAME}
|
|
restart: unless-stopped
|
|
working_dir: /app
|
|
command: sh -c "npm install 2>/dev/null || true && npm start"
|
|
ports:
|
|
- "${HTTP_PORT}:3000"
|
|
volumes:
|
|
- app_data:/app
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3000
|
|
|
|
volumes:
|
|
app_data:
|
|
|
|
post_install: |
|
|
Your Node.js application is ready!
|
|
|
|
To add your code:
|
|
docker cp ./your-files/. ${APP_NAME}:/app/
|
|
|
|
To access shell:
|
|
docker exec -it ${APP_NAME} sh
|
|
|
|
To install packages:
|
|
docker exec -it ${APP_NAME} npm install express
|
|
|
|
Example package.json:
|
|
{
|
|
"name": "my-app",
|
|
"scripts": { "start": "node index.js" },
|
|
"dependencies": { "express": "^4.18.0" }
|
|
}
|
|
|
|
Example index.js:
|
|
const express = require('express');
|
|
const app = express();
|
|
app.get('/', (req, res) => res.send('Hello World!'));
|
|
app.listen(3000);
|