docker dev
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
node_modules
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
.eslint.config.msj
|
||||||
|
.README.md
|
||||||
|
.env.example
|
||||||
12
.env.prod
Normal file
12
.env.prod
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
NEXTAUTH_SECRET=dispatch
|
||||||
|
NEXTAUTH_HUB_SECRET=var
|
||||||
|
NEXTAUTH_COOKIE_PREFIX=DISPATCH
|
||||||
|
NEXT_PUBLIC_DISPATCH_SERVER_URL=http://localhost:3002
|
||||||
|
NEXTAUTH_URL=http://localhost:3001
|
||||||
|
NEXT_PUBLIC_HUB_URL=http://localhost:3000
|
||||||
|
NEXT_PUBLIC_PUBLIC_URL=http://localhost:3001
|
||||||
|
NEXT_PUBLIC_SERVICE_ID=1
|
||||||
|
DATABASE_URL=postgresql://persistant-data:persistant-data-pw@postgres:5432/var
|
||||||
|
NEXT_PUBLIC_LIVEKIT_URL=ws://localhost:7880
|
||||||
|
LIVEKIT_API_KEY=APIAnsGdtdYp2Ho
|
||||||
|
LIVEKIT_API_SECRET=tdPjVsYUx8ddC7K9NvdmVAeLRF9GeADD6Fedm1x63fWC
|
||||||
@@ -3,5 +3,4 @@ Dockerfile
|
|||||||
.dockerignore
|
.dockerignore
|
||||||
.eslint.config.msj
|
.eslint.config.msj
|
||||||
.README.md
|
.README.md
|
||||||
.env
|
|
||||||
.env.example
|
.env.example
|
||||||
@@ -1,29 +1,83 @@
|
|||||||
FROM node:22-alpine
|
FROM node:22-alpine AS base
|
||||||
|
|
||||||
|
|
||||||
|
ENV PNPM_HOME="/usr/local/pnpm"
|
||||||
|
ENV PATH="${PNPM_HOME}:${PATH}"
|
||||||
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
|
RUN pnpm add -g turbo@^2.5
|
||||||
|
|
||||||
|
|
||||||
|
ARG NEXTAUTH_SECRET
|
||||||
|
ARG NEXTAUTH_HUB_SECRET
|
||||||
|
ARG NEXTAUTH_COOKIE_PREFIX
|
||||||
|
ARG NEXT_PUBLIC_DISPATCH_SERVER_URL
|
||||||
|
ARG NEXTAUTH_URL
|
||||||
|
ARG NEXT_PUBLIC_HUB_URL
|
||||||
|
ARG NEXT_PUBLIC_PUBLIC_URL
|
||||||
|
ARG NEXT_PUBLIC_SERVICE_ID
|
||||||
|
ARG DATABASE_URL
|
||||||
|
ARG NEXT_PUBLIC_LIVEKIT_URL
|
||||||
|
ARG LIVEKIT_API_KEY
|
||||||
|
ARG LIVEKIT_API_SECRET
|
||||||
|
|
||||||
|
ENV NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
|
||||||
|
ENV NEXTAUTH_HUB_SECRET=${NEXTAUTH_HUB_SECRET}
|
||||||
|
ENV NEXTAUTH_COOKIE_PREFIX=${NEXTAUTH_COOKIE_PREFIX}
|
||||||
|
ENV NEXT_PUBLIC_DISPATCH_SERVER_URL=${NEXT_PUBLIC_DISPATCH_SERVER_URL}
|
||||||
|
ENV NEXTAUTH_URL=${NEXTAUTH_URL}
|
||||||
|
ENV NEXT_PUBLIC_HUB_URL=${NEXT_PUBLIC_HUB_URL}
|
||||||
|
ENV NEXT_PUBLIC_PUBLIC_URL=${NEXT_PUBLIC_PUBLIC_URL}
|
||||||
|
ENV NEXT_PUBLIC_SERVICE_ID=${NEXT_PUBLIC_SERVICE_ID}
|
||||||
|
ENV DATABASE_URL=${DATABASE_URL}
|
||||||
|
ENV NEXT_PUBLIC_LIVEKIT_URL=${NEXT_PUBLIC_LIVEKIT_URL}
|
||||||
|
ENV LIVEKIT_API_KEY=${LIVEKIT_API_KEY}
|
||||||
|
ENV LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET}
|
||||||
|
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add --no-cache libc6-compat
|
||||||
|
|
||||||
# Set the working directory
|
|
||||||
WORKDIR /usr/app
|
WORKDIR /usr/app
|
||||||
|
|
||||||
# Copy package.json and package-lock.json
|
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# Change ownership to the non-root user
|
|
||||||
RUN chown -R node:node /usr/app
|
|
||||||
|
|
||||||
# Copy the rest of the application code
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN cat .env.prod
|
||||||
|
|
||||||
# Build the application
|
RUN turbo prune dispatch --docker
|
||||||
RUN npm run build
|
|
||||||
|
FROM base AS installer
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add --no-cache libc6-compat
|
||||||
|
|
||||||
|
WORKDIR /usr/app
|
||||||
|
|
||||||
|
COPY --from=builder /usr/app/out/json/ .
|
||||||
|
RUN pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
# Build the project
|
||||||
|
COPY --from=builder /usr/app/out/full/ .
|
||||||
|
|
||||||
|
COPY --from=builder /usr/app/.env.prod ./apps/dispatch/.env
|
||||||
|
RUN cat ./apps/dispatch/.env
|
||||||
|
RUN ls ./apps/dispatch -alR
|
||||||
|
|
||||||
|
RUN turbo run build
|
||||||
|
|
||||||
|
FROM base AS runner
|
||||||
|
WORKDIR /usr/app
|
||||||
|
|
||||||
|
# Don't run production as root
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
USER nextjs
|
||||||
|
|
||||||
|
# Automatically leverage output traces to reduce image size
|
||||||
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||||
|
COPY --from=installer --chown=nextjs:nodejs /usr/app/apps/dispatch/ ./
|
||||||
|
|
||||||
# Expose the application port
|
# Expose the application port
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
|
|
||||||
# Run container as non-root (unprivileged) user
|
CMD ["pnpm", "run", "start"]
|
||||||
# The "node" user is provided in the Node.js Alpine base image
|
|
||||||
USER node
|
|
||||||
|
|
||||||
# Command to run the application
|
|
||||||
CMD ["npm", "start"]
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { io } from "socket.io-client";
|
import { io } from "socket.io-client";
|
||||||
|
|
||||||
export const dispatchSocket = io(process.env.NEXT_PUBLIC_DISPATCH_SERVER_URL, {
|
import type { Socket } from "socket.io-client";
|
||||||
|
|
||||||
|
export const dispatchSocket: Socket = io(process.env.NEXT_PUBLIC_DISPATCH_SERVER_URL, {
|
||||||
autoConnect: false,
|
autoConnect: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { io } from "socket.io-client";
|
import { io, Socket } from "socket.io-client";
|
||||||
|
|
||||||
export const pilotSocket = io(process.env.NEXT_PUBLIC_DISPATCH_SERVER_URL, {
|
export const pilotSocket: Socket = io(process.env.NEXT_PUBLIC_DISPATCH_SERVER_URL, {
|
||||||
autoConnect: false,
|
autoConnect: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,14 +11,19 @@
|
|||||||
"check-types": "tsc --noEmit"
|
"check-types": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@hookform/resolvers": "^4.1.3",
|
||||||
"@livekit/components-react": "^2.8.1",
|
"@livekit/components-react": "^2.8.1",
|
||||||
"@livekit/components-styles": "^1.1.4",
|
"@livekit/components-styles": "^1.1.4",
|
||||||
"@livekit/track-processors": "^0.5.6",
|
"@livekit/track-processors": "^0.5.6",
|
||||||
|
"@next-auth/prisma-adapter": "^1.0.7",
|
||||||
"@radix-ui/react-icons": "^1.3.2",
|
"@radix-ui/react-icons": "^1.3.2",
|
||||||
"@repo/db": "*",
|
"@repo/db": "*",
|
||||||
"@tailwindcss/postcss": "^4.0.14",
|
"@tailwindcss/postcss": "^4.0.14",
|
||||||
"@tanstack/react-query": "^5.75.4",
|
"@tanstack/react-query": "^5.75.4",
|
||||||
|
"@types/jsonwebtoken": "^9.0.9",
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.9.0",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"i": "^0.3.7",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"livekit-client": "^2.9.7",
|
"livekit-client": "^2.9.7",
|
||||||
@@ -26,14 +31,18 @@
|
|||||||
"lucide-react": "^0.511.0",
|
"lucide-react": "^0.511.0",
|
||||||
"next": "^15.1.0",
|
"next": "^15.1.0",
|
||||||
"next-auth": "^4.24.11",
|
"next-auth": "^4.24.11",
|
||||||
|
"npm": "^11.4.1",
|
||||||
"postcss": "^8.5.1",
|
"postcss": "^8.5.1",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-hook-form": "^7.54.2",
|
"react-hook-form": "^7.54.2",
|
||||||
"react-hot-toast": "^2.5.2",
|
"react-hot-toast": "^2.5.2",
|
||||||
"react-leaflet": "^5.0.0-rc.2",
|
"react-leaflet": "^5.0.0-rc.2",
|
||||||
|
"react-select": "^5.10.1",
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.1",
|
||||||
|
"tailwind-merge": "^3.3.0",
|
||||||
"tailwindcss": "^4.0.14",
|
"tailwindcss": "^4.0.14",
|
||||||
|
"zod": "^3.25.28",
|
||||||
"zustand": "^5.0.3",
|
"zustand": "^5.0.3",
|
||||||
"zustand-sync-tabs": "^0.2.2"
|
"zustand-sync-tabs": "^0.2.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
"@hookform/resolvers": "^4.1.3",
|
"@hookform/resolvers": "^4.1.3",
|
||||||
"@next-auth/prisma-adapter": "^1.0.7",
|
"@next-auth/prisma-adapter": "^1.0.7",
|
||||||
"@repo/db": "*",
|
"@repo/db": "*",
|
||||||
"@repo/ui": "*",
|
|
||||||
"@tanstack/react-query": "^5.67.2",
|
"@tanstack/react-query": "^5.67.2",
|
||||||
"@tanstack/react-table": "^8.20.6",
|
"@tanstack/react-table": "^8.20.6",
|
||||||
"@uiw/react-md-editor": "^4.0.5",
|
"@uiw/react-md-editor": "^4.0.5",
|
||||||
|
|||||||
129
docker-compose.prod.yml
Normal file
129
docker-compose.prod.yml
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
services:
|
||||||
|
dispatch:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./apps/dispatch/Dockerfile
|
||||||
|
args:
|
||||||
|
# alle Variablen aus .env.prod automatisch übernehmen
|
||||||
|
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
|
||||||
|
NEXTAUTH_HUB_SECRET: ${NEXTAUTH_HUB_SECRET}
|
||||||
|
NEXTAUTH_COOKIE_PREFIX: ${NEXTAUTH_COOKIE_PREFIX}
|
||||||
|
NEXT_PUBLIC_DISPATCH_SERVER_URL: ${NEXT_PUBLIC_DISPATCH_SERVER_URL}
|
||||||
|
NEXTAUTH_URL: ${NEXTAUTH_URL}
|
||||||
|
NEXT_PUBLIC_HUB_URL: ${NEXT_PUBLIC_HUB_URL}
|
||||||
|
NEXT_PUBLIC_PUBLIC_URL: ${NEXT_PUBLIC_PUBLIC_URL}
|
||||||
|
NEXT_PUBLIC_SERVICE_ID: ${NEXT_PUBLIC_SERVICE_ID}
|
||||||
|
DATABASE_URL: ${DATABASE_URL}
|
||||||
|
NEXT_PUBLIC_LIVEKIT_URL: ${NEXT_PUBLIC_LIVEKIT_URL}
|
||||||
|
LIVEKIT_API_KEY: ${LIVEKIT_API_KEY}
|
||||||
|
LIVEKIT_API_SECRET: ${LIVEKIT_API_SECRET}
|
||||||
|
container_name: dispatch
|
||||||
|
ports:
|
||||||
|
- "3001:3001"
|
||||||
|
env_file:
|
||||||
|
- ./apps/dispatch/.env
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- postgres_network
|
||||||
|
postgres:
|
||||||
|
image: postgres:13
|
||||||
|
container_name: postgres
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U persistant-data -d var"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: persistant-data
|
||||||
|
POSTGRES_PASSWORD: persistant-data-pw
|
||||||
|
POSTGRES_DB: var
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- postgres_network
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
container_name: grafana
|
||||||
|
ports:
|
||||||
|
- "4100:3000"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
volumes:
|
||||||
|
- ./grafana:/var/lib/grafana
|
||||||
|
redis:
|
||||||
|
container_name: redis
|
||||||
|
image: redis/redis-stack:latest
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- "redis_data:/data"
|
||||||
|
|
||||||
|
moodle_database:
|
||||||
|
container_name: moodle_database
|
||||||
|
image: docker.io/bitnami/mariadb:latest
|
||||||
|
environment:
|
||||||
|
# ALLOW_EMPTY_PASSWORD is recommended only for development.
|
||||||
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
- MARIADB_USER=bn_moodle
|
||||||
|
- MARIADB_DATABASE=bitnami_moodle
|
||||||
|
- MARIADB_CHARACTER_SET=utf8mb4
|
||||||
|
- MARIADB_COLLATE=utf8mb4_unicode_ci
|
||||||
|
volumes:
|
||||||
|
- "moodle_database:/bitnami/mariadb"
|
||||||
|
moodle:
|
||||||
|
image: bitnami/moodle:latest
|
||||||
|
container_name: moodle
|
||||||
|
ports:
|
||||||
|
- "8081:8080" # Moodle läuft auf http://localhost:8081
|
||||||
|
environment:
|
||||||
|
- MOODLE_DATABASE_HOST=moodle_database
|
||||||
|
- MOODLE_DATABASE_PORT_NUMBER=3306
|
||||||
|
- MOODLE_DATABASE_USER=bn_moodle
|
||||||
|
- MOODLE_DATABASE_NAME=bitnami_moodle
|
||||||
|
|
||||||
|
- MOODLE_USERNAME=admin
|
||||||
|
- MOODLE_PASSWORD=admin123
|
||||||
|
- MOODLE_EMAIL=admin@example.com
|
||||||
|
- MOODLE_SITE_NAME="Mein Lokales Moodle"
|
||||||
|
- MOODLE_SSLPROXY=false
|
||||||
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
depends_on:
|
||||||
|
- moodle_database
|
||||||
|
volumes:
|
||||||
|
- moodle_data:/bitnami/moodle
|
||||||
|
- moodle_moodledata:/bitnami/moodledata
|
||||||
|
# Für den Zugriff auf den Host
|
||||||
|
livekit-server:
|
||||||
|
image: livekit/livekit-server
|
||||||
|
container_name: livekit_server
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "7880:7880"
|
||||||
|
- "7881:7881"
|
||||||
|
- "7882:7882/udp"
|
||||||
|
volumes:
|
||||||
|
- "./livekit.yaml:/livekit.yaml"
|
||||||
|
command:
|
||||||
|
- "--config"
|
||||||
|
- "/livekit.yaml"
|
||||||
|
- "--node-ip=127.0.0.1"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
postgres_network:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-data:
|
||||||
|
moodle_data:
|
||||||
|
moodle_database:
|
||||||
|
moodle_moodledata:
|
||||||
|
redis_data:
|
||||||
|
driver: local
|
||||||
18189
package-lock.json
generated
18189
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,9 +15,10 @@
|
|||||||
"typescript": "^5.8.2"
|
"typescript": "^5.8.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18",
|
||||||
|
"pnpm": ">=10"
|
||||||
},
|
},
|
||||||
"packageManager": "npm@10.2.3",
|
"packageManager": "pnpm@10.11.0",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"apps/*",
|
"apps/*",
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^6.6.0",
|
"@prisma/client": "^6.6.0",
|
||||||
|
"zod": "^3.25.28",
|
||||||
"zod-prisma-types": "^3.2.4"
|
"zod-prisma-types": "^3.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
8915
pnpm-lock.yaml
generated
Normal file
8915
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
pnpm-workspace.yaml
Normal file
10
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
packages:
|
||||||
|
- apps/*
|
||||||
|
- packages/*
|
||||||
|
onlyBuiltDependencies:
|
||||||
|
- '@prisma/client'
|
||||||
|
- '@prisma/engines'
|
||||||
|
- '@tailwindcss/oxide'
|
||||||
|
- prisma
|
||||||
|
- sharp
|
||||||
|
- unrs-resolver
|
||||||
14
turbo.json
14
turbo.json
@@ -1,7 +1,17 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://turbo.build/schema.json",
|
"$schema": "https://turbo.build/schema.json",
|
||||||
"globalDependencies": ["**/.env.*local"],
|
"globalDependencies": ["**/.env.*local"],
|
||||||
"globalEnv": ["EMAIL_SERVER", "EMAIL_FROM", "SECRET", "DATABASE_URL", "NEXTAUTH_SECRET"],
|
"globalEnv": [
|
||||||
|
"EMAIL_SERVER",
|
||||||
|
"EMAIL_FROM",
|
||||||
|
"SECRET",
|
||||||
|
"DATABASE_URL",
|
||||||
|
"NEXTAUTH_SECRET",
|
||||||
|
"LIVEKIT_API_KEY",
|
||||||
|
"LIVEKIT_API_SECRET",
|
||||||
|
"NEXTAUTH_HUB_SECRET",
|
||||||
|
"NEXTAUTH_COOKIE_PREFIX"
|
||||||
|
],
|
||||||
"ui": "tui",
|
"ui": "tui",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"generate": {
|
"generate": {
|
||||||
@@ -13,7 +23,7 @@
|
|||||||
"persistent": false
|
"persistent": false
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"dependsOn": ["^build", "generate", "migrate"],
|
"dependsOn": ["^build", "generate"],
|
||||||
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
"inputs": ["$TURBO_DEFAULT$", ".env*"],
|
||||||
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
|
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user