Compare commits
7 Commits
d93f43bf01
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1de1c9dcde | |||
| 2f94039f02 | |||
| 6ebebfad9a | |||
| ed0be3b583 | |||
| 666c7724c5 | |||
| 94206afd49 | |||
| 0084c5f05b |
@@ -76,6 +76,9 @@ COPY --from=builder /app/apps/admin/.next/standalone ./
|
|||||||
COPY --from=builder /app/apps/admin/.next/static ./apps/admin/.next/static
|
COPY --from=builder /app/apps/admin/.next/static ./apps/admin/.next/static
|
||||||
COPY --from=builder /app/apps/admin/public ./apps/admin/public
|
COPY --from=builder /app/apps/admin/public ./apps/admin/public
|
||||||
|
|
||||||
|
# Fix permissions so nextjs user can write to .next/cache at runtime
|
||||||
|
RUN chown -R nextjs:nodejs /app/apps/admin/.next
|
||||||
|
|
||||||
# Copy Prisma schema + migrations for runtime migrations
|
# Copy Prisma schema + migrations for runtime migrations
|
||||||
COPY --from=builder /app/packages/shared/prisma ./packages/shared/prisma
|
COPY --from=builder /app/packages/shared/prisma ./packages/shared/prisma
|
||||||
|
|
||||||
|
|||||||
16
innungsapp/apps/admin/docker-entrypoint.sh
Normal file → Executable file
16
innungsapp/apps/admin/docker-entrypoint.sh
Normal file → Executable file
@@ -43,14 +43,14 @@ run_with_retries() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Prefer migration-based deploys. Fall back to db push when no migrations exist yet.
|
# Prefer migration-based deploys. Fall back to db push when no migrations exist yet.
|
||||||
set -- "$MIGRATIONS_DIR"/*/migration.sql
|
# set -- "$MIGRATIONS_DIR"/*/migration.sql
|
||||||
if [ -f "$1" ]; then
|
# if [ -f "$1" ]; then
|
||||||
echo "Applying Prisma migrations..."
|
# echo "Applying Prisma migrations..."
|
||||||
run_with_retries npx prisma migrate deploy --schema=./packages/shared/prisma/schema.prisma
|
# run_with_retries npx prisma migrate deploy --schema=./packages/shared/prisma/schema.prisma
|
||||||
else
|
# else
|
||||||
echo "No Prisma migrations found. Syncing schema with db push..."
|
# echo "No Prisma migrations found. Syncing schema with db push..."
|
||||||
run_with_retries npx prisma db push --skip-generate --schema=./packages/shared/prisma/schema.prisma
|
# run_with_retries npx prisma db push --skip-generate --schema=./packages/shared/prisma/schema.prisma
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
echo "Starting Next.js server..."
|
echo "Starting Next.js server..."
|
||||||
exec node apps/admin/server.js
|
exec node apps/admin/server.js
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ export function middleware(request: NextRequest) {
|
|||||||
// We don't want to redirect /login, /api, etc.
|
// We don't want to redirect /login, /api, etc.
|
||||||
const SHARED_PATHS = ['login', 'api', 'superadmin', 'dashboard', 'registrierung', 'impressum', 'datenschutz', '_next', 'uploads', 'favicon.ico', 'passwort-aendern']
|
const SHARED_PATHS = ['login', 'api', 'superadmin', 'dashboard', 'registrierung', 'impressum', 'datenschutz', '_next', 'uploads', 'favicon.ico', 'passwort-aendern']
|
||||||
const isStaticAsset = /\.(png|jpg|jpeg|gif|svg|webp|ico|txt|xml)$/i.test(potentialSlug)
|
const isStaticAsset = /\.(png|jpg|jpeg|gif|svg|webp|ico|txt|xml)$/i.test(potentialSlug)
|
||||||
if (potentialSlug && !SHARED_PATHS.includes(potentialSlug) && !isStaticAsset) {
|
const isValidSlug = /^[a-z0-9][a-z0-9-]*$/.test(potentialSlug)
|
||||||
|
if (potentialSlug && !SHARED_PATHS.includes(potentialSlug) && !isStaticAsset && isValidSlug) {
|
||||||
// This looks like a tenant path being accessed from the root domain.
|
// This looks like a tenant path being accessed from the root domain.
|
||||||
// Redirect to subdomain.
|
// Redirect to subdomain.
|
||||||
const baseHost = hostname.split('.').slice(-2).join('.') // Simplistic, assumes domain.tld or localhost
|
const baseHost = hostname.split('.').slice(-2).join('.') // Simplistic, assumes domain.tld or localhost
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ services:
|
|||||||
POSTGRES_DB: "${POSTGRES_DB:-innungsapp}"
|
POSTGRES_DB: "${POSTGRES_DB:-innungsapp}"
|
||||||
POSTGRES_USER: "${POSTGRES_USER:-innungsapp}"
|
POSTGRES_USER: "${POSTGRES_USER:-innungsapp}"
|
||||||
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-innungsapp}"
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-innungsapp}"
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
volumes:
|
||||||
- pg_data:/var/lib/postgresql/data
|
- pg_data:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- bizmatch # <-- NEU
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-innungsapp} -d ${POSTGRES_DB:-innungsapp}"]
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-innungsapp} -d ${POSTGRES_DB:-innungsapp}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -32,8 +32,6 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
ports:
|
|
||||||
- "3010:3000"
|
|
||||||
environment:
|
environment:
|
||||||
# Database — PostgreSQL
|
# Database — PostgreSQL
|
||||||
DATABASE_URL: "${DATABASE_URL:-postgresql://innungsapp:innungsapp@postgres:5432/innungsapp?schema=public}"
|
DATABASE_URL: "${DATABASE_URL:-postgresql://innungsapp:innungsapp@postgres:5432/innungsapp?schema=public}"
|
||||||
@@ -71,7 +69,9 @@ services:
|
|||||||
nproc: 65535
|
nproc: 65535
|
||||||
volumes:
|
volumes:
|
||||||
# Uploaded files — persists across restarts
|
# Uploaded files — persists across restarts
|
||||||
- uploads_data:/app/uploads
|
- ./uploads:/app/uploads
|
||||||
|
networks:
|
||||||
|
- bizmatch # <-- NEU
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/health | grep -q '\"status\":\"ok\"'"]
|
test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/health | grep -q '\"status\":\"ok\"'"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -81,4 +81,7 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pg_data:
|
pg_data:
|
||||||
uploads_data:
|
|
||||||
|
networks:
|
||||||
|
bizmatch:
|
||||||
|
external: true
|
||||||
Binary file not shown.
Reference in New Issue
Block a user