# Define your Docker Compose directory $composeDir = "C:\Users\johnn\Desktop\Docker\Nextcloud" # Create the directory if it does not exist if (-not (Test-Path $composeDir)) { New-Item -ItemType Directory -Path $composeDir } # Change to the target directory Set-Location -Path $composeDir # Create a docker-compose.yml file for Nextcloud $dockerComposeContent = @" version: '3.8' services: nextcloud: image: nextcloud:latest container_name: nextcloud ports: - "8080:80" environment: MYSQL_PASSWORD: secret MYSQL_DATABASE: nextcloud MYSQL_USER: nextcloud MYSQL_HOST: db volumes: - nextcloud_data:/var/www/html depends_on: - db restart: unless-stopped db: image: mysql:5.7 container_name: nextcloud_db environment: MYSQL_ROOT_PASSWORD: secret MYSQL_DATABASE: nextcloud MYSQL_USER: nextcloud MYSQL_PASSWORD: secret volumes: - nextcloud_db_data:/var/lib/mysql restart: unless-stopped redis: image: redis:latest container_name: redis restart: unless-stopped volumes: nextcloud_data: nextcloud_db_data: "@ # Write docker-compose.yml to the directory $dockerComposeContent | Out-File -FilePath "$composeDir\docker-compose.yml" -Force # Pull the Docker images and start the containers Write-Host "Running docker-compose up..." docker-compose -f "$composeDir\docker-compose.yml" up -d # Wait for Nextcloud to fully initialize Write-Host "Waiting for Nextcloud to initialize..." Start-Sleep -Seconds 30 # Accessing Nextcloud to install Appointments app manually Write-Host "Nextcloud setup completed. Access it at http://localhost:8080" Write-Host "Please log in and install the Appointments app from the Nextcloud app store."