Commit 2613ad71 authored by Hendrik Garske's avatar Hendrik Garske

docs: Docker-Setup-Anleitung zur README hinzugefügt

parent 7660807f
Pipeline #15 canceled with stages
......@@ -395,6 +395,106 @@ Neuen Zeiteintrag erstellen
#### DELETE `/api/time-entries/[id]`
Zeiteintrag löschen
## 🐳 Docker Setup
### Docker Compose (Empfohlen)
Erstellen Sie eine `docker-compose.yml` Datei:
```yaml
version: '3.8'
services:
postgres:
image: postgres:15
container_name: corex-postgres
environment:
POSTGRES_USER: corex_user
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: corex_dashboard
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
app:
build: .
container_name: corex-dashboard
ports:
- "3000:3000"
environment:
DATABASE_URL: postgresql://corex_user:${POSTGRES_PASSWORD}@postgres:5432/corex_dashboard?schema=public
NODE_ENV: production
depends_on:
- postgres
restart: unless-stopped
volumes:
postgres_data:
```
**Start mit Docker Compose:**
```bash
# .env Datei erstellen
echo "POSTGRES_PASSWORD=ihr_sicheres_passwort" > .env
# Services starten
docker-compose up -d
# Logs anzeigen
docker-compose logs -f
# Services stoppen
docker-compose down
```
### Dockerfile
Erstellen Sie eine `Dockerfile`:
```dockerfile
FROM node:20-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npx prisma generate
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]
```
## 🚢 Deployment
### GitLab CI/CD
......@@ -405,6 +505,8 @@ Das Projekt verwendet GitLab CI/CD für automatische Builds und Tests.
1. **Build**: Kompiliert TypeScript, generiert Prisma Client
2. **Test**: Führt ESLint aus
> ⚠️ **Privates Repository**: CI/CD ist nur für autorisierte GitLab-Nutzer verfügbar.
### Umgebungsvariablen für Deployment
Stellen Sie sicher, dass folgende Variablen in Ihrer Deployment-Umgebung gesetzt sind:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment