Erstelle Docker-Setup mit Installationsskripten für Frontend und Backend

- Füge Docker-Compose-Konfiguration mit Host-Netzwerk für Frontend und Backend hinzu
- Erstelle Dockerfile für das Frontend mit automatischer Datenbankmigration
- Aktualisiere Backend-Docker-Compose mit korrekten Umgebungsvariablen
- Implementiere Installationsskripte:
  - install-myp.sh: Vollständige Installation beider Komponenten
  - start-myp.sh: Starten der installierten Container
  - stop-myp.sh: Stoppen der Container
  - setup-backend-env.sh: Einrichten der Backend-Umgebungsvariablen
- Korrigiere SQLite-Datenbankprobleme im Frontend

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-31 10:36:16 +02:00
parent 4db5512b57
commit 951473d1ec
8 changed files with 338 additions and 23 deletions

4
packages/reservation-platform/.env.example Executable file → Normal file
View File

@@ -1,3 +1,7 @@
# Basic Server Configuration
RUNTIME_ENVIRONMENT=dev
DB_PATH=db/sqlite.db
# OAuth Configuration
OAUTH_CLIENT_ID=client_id
OAUTH_CLIENT_SECRET=client_secret

38
packages/reservation-platform/Dockerfile Executable file → Normal file
View File

@@ -1,34 +1,32 @@
FROM node:20-bookworm-slim
FROM node:20-alpine
# Create application directory
RUN mkdir -p /usr/src/app
WORKDIR /app
# Set environment variables
ENV PORT=3000
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /usr/src/app
# Copy package.json and pnpm-lock.yaml
COPY package.json /usr/src/app
COPY pnpm-lock.yaml /usr/src/app
# Install system dependencies
RUN apk add --no-cache python3 build-base g++ make
# Install pnpm
RUN corepack enable pnpm
RUN npm install -g pnpm
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install
RUN pnpm install --frozen-lockfile
# Copy the rest of the application code
COPY . /usr/src/app
# Copy source code
COPY . .
# Initialize Database, if it not already exists
RUN pnpm run db
# Create database directory and run migrations
RUN mkdir -p db/
RUN pnpm db:generate-sqlite
RUN pnpm db:migrate
# Build the application
RUN pnpm run build
RUN pnpm build
# Expose the port
EXPOSE 3000
# Start the application
CMD ["/bin/sh", "-c", "if [ ! -f ./db/sqlite.db ]; then pnpm db; fi && pnpm start"]
CMD ["pnpm", "start"]

View File

@@ -0,0 +1,16 @@
version: '3'
services:
frontend:
build:
context: .
dockerfile: Dockerfile
container_name: myp-frontend
network_mode: host
environment:
- RUNTIME_ENVIRONMENT=${RUNTIME_ENVIRONMENT:-dev}
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID:-client_id}
- OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET:-client_secret}
volumes:
- ./db:/app/db
restart: unless-stopped