sdfsdf
This commit is contained in:
parent
0e523a0823
commit
469faf87c1
37
Dockerfile
37
Dockerfile
|
|
@ -1,37 +0,0 @@
|
||||||
# ---- deps ----
|
|
||||||
FROM node:18-alpine AS deps
|
|
||||||
WORKDIR /app
|
|
||||||
COPY package*.json ./
|
|
||||||
# Für reproduzierbare Builds: CI bevorzugt
|
|
||||||
RUN npm ci
|
|
||||||
|
|
||||||
# ---- builder ----
|
|
||||||
FROM node:18-alpine AS builder
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
COPY . .
|
|
||||||
# Falls du Prisma o.ä. verwendest, optional vor dem Build:
|
|
||||||
# RUN npx prisma generate
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# ---- runner (Variante A: Standard "npm start") ----
|
|
||||||
# Nutze diese Runner-Stufe, wenn du KEIN 'output: standalone' hast:
|
|
||||||
FROM node:18-alpine AS runner
|
|
||||||
WORKDIR /app
|
|
||||||
ENV PORT=3000
|
|
||||||
COPY --from=builder /app ./
|
|
||||||
EXPOSE 3000
|
|
||||||
CMD ["npm", "start"]
|
|
||||||
|
|
||||||
# ---- runner-standalone (Variante B: Next.js Standalone) ----
|
|
||||||
# Wenn du in next.config.js 'output: "standalone"' gesetzt hast,
|
|
||||||
# kannst du stattdessen diese Runner-Stufe verwenden und die obere auskommentieren:
|
|
||||||
# FROM node:18-alpine AS runner
|
|
||||||
# WORKDIR /app
|
|
||||||
# ENV NODE_ENV=production
|
|
||||||
# ENV PORT=3000
|
|
||||||
# COPY --from=builder /app/.next/standalone ./
|
|
||||||
# COPY --from=builder /app/.next/static ./.next/static
|
|
||||||
# COPY --from=builder /app/public ./public
|
|
||||||
# EXPOSE 3000
|
|
||||||
# CMD ["node", "server.js"]
|
|
||||||
|
|
@ -1,70 +1,45 @@
|
||||||
version: "3.9"
|
version: "3.9"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# ======== PROD ========
|
app:
|
||||||
mail-admin:
|
|
||||||
# Nur aktiv, wenn Profil 'prod' gesetzt ist
|
|
||||||
profiles: ["prod"]
|
|
||||||
container_name: mail-s3-admin
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
environment:
|
|
||||||
# Next.js & DB
|
|
||||||
NODE_ENV: production
|
|
||||||
DATABASE_URL: postgresql://postgres:fiesta@postgres:5432/mydb
|
|
||||||
# Deine App-Variablen
|
|
||||||
APP_PASSWORD: ${APP_PASSWORD}
|
|
||||||
PROCESSED_META_KEY: ${PROCESSED_META_KEY}
|
|
||||||
PROCESSED_META_VALUE: ${PROCESSED_META_VALUE}
|
|
||||||
# Optional hilfreich:
|
|
||||||
NEXT_TELEMETRY_DISABLED: "1"
|
|
||||||
ports:
|
|
||||||
- "3060:3000"
|
|
||||||
depends_on:
|
|
||||||
- postgres
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
# ======== DEV ========
|
|
||||||
mail-admin-dev:
|
|
||||||
profiles: ["dev"]
|
|
||||||
container_name: mail-s3-admin-dev
|
|
||||||
image: node:18-alpine
|
image: node:18-alpine
|
||||||
|
container_name: mail-s3-admin-dev
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command: sh -c "npm install && npm run dev"
|
# Wichtig: Next.js Dev muss nach außen erreichbar sein
|
||||||
|
command: sh -c "npm run dev -- -p 3000 -H 0.0.0.0"
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
|
# Hot-Reload in Docker auf Windows/macOS
|
||||||
|
CHOKIDAR_USEPOLLING: "true"
|
||||||
|
WATCHPACK_POLLING: "true"
|
||||||
|
# Deine App-Variablen
|
||||||
DATABASE_URL: postgresql://postgres:fiesta@postgres:5432/mydb
|
DATABASE_URL: postgresql://postgres:fiesta@postgres:5432/mydb
|
||||||
APP_PASSWORD: ${APP_PASSWORD}
|
APP_PASSWORD: ${APP_PASSWORD}
|
||||||
PROCESSED_META_KEY: ${PROCESSED_META_KEY}
|
PROCESSED_META_KEY: ${PROCESSED_META_KEY}
|
||||||
PROCESSED_META_VALUE: ${PROCESSED_META_VALUE}
|
PROCESSED_META_VALUE: ${PROCESSED_META_VALUE}
|
||||||
|
# (Optional) Next Telemetry aus
|
||||||
NEXT_TELEMETRY_DISABLED: "1"
|
NEXT_TELEMETRY_DISABLED: "1"
|
||||||
ports:
|
ports:
|
||||||
- "3060:3000"
|
- "3060:3000"
|
||||||
|
volumes:
|
||||||
|
- .:/app:cached # Dein Projektordner direkt im Container
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
volumes:
|
# Für interaktive Logs (CTRL+C sauber)
|
||||||
- .:/app:cached # Quellcode aus dem Host
|
tty: true
|
||||||
- /app/node_modules # Anonymes Volume: verhindert Konflikte mit Host
|
stdin_open: true
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
# ======== POSTGRES (geteilt) ========
|
|
||||||
postgres:
|
postgres:
|
||||||
container_name: mail-s3-admin-db
|
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
|
container_name: mail-s3-admin-db
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: fiesta
|
POSTGRES_PASSWORD: fiesta
|
||||||
POSTGRES_DB: mydb
|
POSTGRES_DB: mydb
|
||||||
ports:
|
ports:
|
||||||
- "5434:5432" # optional, nur nötig wenn du lokal via Host-Port zugreifen willst
|
- "5434:5432" # Optional: Host-Zugriff auf DB
|
||||||
volumes:
|
volumes:
|
||||||
- postgres-data:/var/lib/postgresql/data
|
- postgres-data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U postgres -d mydb || exit 1"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 10
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue