CoolFace
Apppublic

malepati/custom_template_working

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
prepare_deploy.py49 linesDownload Raw Back to root
1import os2import shutil3import pathlib4 5 6SOURCE_DIR = os.getcwd()7DEPLOY_DIR = os.path.join(SOURCE_DIR, "deploy_output")8 9# Ignore patterns10IGNORE_PATTERNS = shutil.ignore_patterns(11    "node_modules", 12    "venv", 13    ".venv", 14    ".next", 15    ".git", 16    "__pycache__", 17    "*.pyc", 18    "tmp",19    ".next-build",20    "test.db",21    "chroma",22    "deploy_output"23)24 25def prepare_deploy():26    if os.path.exists(DEPLOY_DIR):27        print(f"Cleaning existing deploy folder: {DEPLOY_DIR}")28        shutil.rmtree(DEPLOY_DIR)29    30    print(f"Copying clean files from {SOURCE_DIR} to {DEPLOY_DIR}...")31    32    try:33        shutil.copytree(SOURCE_DIR, DEPLOY_DIR, ignore=IGNORE_PATTERNS)34        35        # Overwrite Dockerfile with Dockerfile.hf for Hugging Face deployment36        hf_dockerfile = os.path.join(SOURCE_DIR, "Dockerfile.hf")37        target_dockerfile = os.path.join(DEPLOY_DIR, "Dockerfile")38        if os.path.exists(hf_dockerfile):39            print("Overwriting Dockerfile with Dockerfile.hf")40            shutil.copy2(hf_dockerfile, target_dockerfile)41            42        print("Success! Deployment folder ready.")43        print(f"Location: {DEPLOY_DIR}")44    except Exception as e:45        print(f"Error during copy: {e}")46 47if __name__ == "__main__":48    prepare_deploy()49