Initial dev-1.0 commit for TS and Shadcn migration

This commit is contained in:
LukeGus
2025-07-17 01:13:30 -05:00
commit 00a827df09
82 changed files with 45402 additions and 0 deletions

81
docker/Dockerfile Normal file
View File

@@ -0,0 +1,81 @@
# Stage 1: Install dependencies and build frontend
FROM node:18-alpine AS deps
WORKDIR /app
# Copy dependency files
COPY package*.json ./
# Install dependencies with caching
RUN npm ci --force && \
npm cache clean --force
# Stage 2: Build frontend
FROM deps AS frontend-builder
WORKDIR /app
# Copy source files
COPY . .
# Build frontend
RUN npm run build
# Stage 3: Production dependencies
FROM node:18-alpine AS production-deps
WORKDIR /app
# Copy only production dependency files
COPY package*.json ./
# Install only production dependencies
RUN npm ci --only=production --ignore-scripts --force && \
npm cache clean --force
# Stage 4: Build native modules
FROM node:18-alpine AS native-builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache python3 make g++
# Copy dependency files
COPY package*.json ./
# Install only the native modules we need
RUN npm ci --only=production bcrypt better-sqlite3 --force && \
npm cache clean --force
# Stage 5: Final image
FROM node:18-alpine
ENV DATA_DIR=/app/data \
PORT=8080
# Install dependencies in a single layer
RUN apk add --no-cache nginx gettext su-exec && \
mkdir -p /app/data && \
chown -R node:node /app/data
# Setup nginx and frontend
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY --from=frontend-builder /app/dist /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html
# Setup backend
WORKDIR /app
COPY package*.json ./
# Copy production dependencies and native modules
COPY --from=production-deps /app/node_modules /app/node_modules
COPY --from=native-builder /app/node_modules/bcrypt /app/node_modules/bcrypt
COPY --from=native-builder /app/node_modules/better-sqlite3 /app/node_modules/better-sqlite3
# Copy backend source
COPY src/backend/ ./src/backend/
RUN chown -R node:node /app
VOLUME ["/app/data"]
# Expose ports
EXPOSE ${PORT} 8081 8082 8083 8084 8085
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
CMD ["/entrypoint.sh"]

17
docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,17 @@
services:
termix:
#image: ghcr.io/lukegus/termix:latest
image: ghcr.io/lukegus/termix:dev-0.3-development-latest
container_name: termix
restart: unless-stopped
ports:
- "3800:8080"
volumes:
- termix-data:/app/data
environment:
# Generate random salt here https://www.lastpass.com/features/password-generator (max 32 characters, include all characters for settings)
SALT: "2v.F7!6a!jIzmJsu|[)h61$ZMXs;,i+~"
volumes:
termix-data:
driver: local

30
docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
set -e
export PORT=${PORT:-8080}
echo "Configuring web UI to run on port: $PORT"
envsubst '${PORT}' < /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.tmp
mv /etc/nginx/nginx.conf.tmp /etc/nginx/nginx.conf
mkdir -p /app/data
chown -R node:node /app/data
chmod 755 /app/data
echo "Starting nginx..."
nginx
# Start backend services
echo "Starting backend services..."
cd /app
export NODE_ENV=production
if command -v su-exec > /dev/null 2>&1; then
su-exec node node src/backend/starter.cjs
else
su -s /bin/sh node -c "node src/backend/starter.cjs"
fi
echo "All services started"
tail -f /dev/null

91
docker/nginx.conf Normal file
View File

@@ -0,0 +1,91 @@
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen ${PORT};
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /database.io/ {
proxy_pass http://127.0.0.1:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /ssh.io/ {
proxy_pass http://127.0.0.1:8082;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /rdp.io/ {
proxy_pass http://127.0.0.1:8083;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /vnc.io/ {
proxy_pass http://127.0.0.1:8084;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /sftp.io/ {
proxy_pass http://127.0.0.1:8085;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}