#!/bin/sh

# Create .storage directories if they don't exist (as root)
mkdir -p /app/.storage/users
mkdir -p /app/.storage/bookings
mkdir -p /app/.storage/treatments
mkdir -p /app/.storage/availability
mkdir -p /app/.storage/cancellation-tokens

# Change ownership to nextjs user
chown -R nextjs:nodejs /app/.storage

# Start the application as nextjs user
exec su-exec nextjs node server-dist/index.js
