Files
mRemotify/docker/backend.Dockerfile
FelixG 3802924c6a Initial scaffold: full-stack mRemotify monorepo
Sets up the complete mRemotify project — a browser-based remote
connection manager — with a working pnpm workspace monorepo:

Frontend (React + TypeScript + Vite + Ant Design 5):
- Login page with JWT auth
- Resizable sidebar with drag-and-drop connection tree (folders + connections)
- Tabbed session area (SSH via xterm.js, RDP via guacamole-common-js)
- Connection CRUD modal with SSH/RDP-specific fields
- Zustand store for auth, tree data, and open sessions

Backend (Fastify + TypeScript + Prisma + PostgreSQL):
- JWT authentication (login + /me endpoint)
- Full CRUD REST API for folders (self-referencing) and connections
- AES-256-CBC password encryption at rest
- WebSocket proxy for SSH sessions (ssh2 <-> xterm.js)
- WebSocket proxy for RDP sessions (guacd TCP handshake + bidirectional relay)
- Admin user seeding on first start

Infrastructure:
- Docker Compose: postgres (healthcheck) + guacd + backend + frontend/nginx
- nginx: serves SPA, proxies /api and /ws (with WebSocket upgrade) to backend
- .env.example with all required variables documented

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 12:21:36 +01:00

39 lines
887 B
Docker

# syntax=docker/dockerfile:1
# ---- Build stage ----
FROM node:20-alpine AS builder
WORKDIR /app
# Install all dependencies (including devDeps for tsc, prisma CLI, tsx)
COPY backend/package*.json ./
RUN npm install
# Copy backend source files
COPY backend/prisma ./prisma
COPY backend/src ./src
COPY backend/tsconfig.json ./
# Generate Prisma client and compile TypeScript
RUN npx prisma generate
RUN npx tsc
# ---- Runtime stage ----
FROM node:20-alpine AS runner
WORKDIR /app
# Copy only production runtime artifacts
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/package.json ./
EXPOSE 3000
# Migrate schema, seed admin user, then start the server
CMD ["sh", "-c", \
"node_modules/.bin/prisma migrate deploy && \
node dist/seed.js && \
node dist/index.js"]