#!/bin/sh set -e # Ensure data directory exists mkdir -p /app/data # Skip dependency installation entirely for pre-built images # Dependencies are already installed during the Docker build process # Initialize the database if it doesn't exist if [ ! -f "/app/data/gitea-mirror.db" ]; then echo "Initializing database..." if [ -f "dist/scripts/init-db.js" ]; then bun dist/scripts/init-db.js elif [ -f "dist/scripts/manage-db.js" ]; then bun dist/scripts/manage-db.js init elif [ -f "scripts/manage-db.ts" ]; then bun scripts/manage-db.ts init else echo "Warning: Could not find database initialization scripts in dist/scripts." echo "Creating and initializing database manually..." # Create the database file touch /app/data/gitea-mirror.db # Initialize the database with required tables sqlite3 /app/data/gitea-mirror.db <