diff --git a/Dockerfile b/Dockerfile index 4196c08..42c5de4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,62 +1,63 @@ -# Use a specific version of Ubuntu as the base image -FROM ubuntu:24.04 - -# Set environment variables -ENV DEBIAN_FRONTEND=noninteractive \ - TZ="Etc/UTC" \ - PATH="/root/.local/bin/:$PATH" - -# Install minimal runtime dependencies -RUN apt-get update && \ - apt-get install -y \ - python3 \ - python3-pip \ - python3-venv \ - postgresql-client \ - software-properties-common \ - tzdata \ - ffmpeg \ - curl \ - unzip \ - git && \ - # Add the PPA and install audiowaveform - add-apt-repository ppa:chris-needham/ppa && \ - apt-get update && \ - apt-get install -y audiowaveform && \ - # Install UV - curl -sSL https://astral.sh/uv/install.sh -o /uv-installer.sh && \ - sh /uv-installer.sh && \ - rm /uv-installer.sh && \ - # Install Node.js - curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \ - apt-get install -y nodejs && \ - # Clean up - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set working directory -WORKDIR /app - -# Copy only the files needed for dependency installation and runtime -COPY . . - -# Copy environment variables for initial build -# We use dynamic environment variables at runtime -# No .env file needed during build - -# Install node dependencies and build frontend -RUN npm ci && \ - npm install && \ - npm run build - -# Ensure entrypoint script is executable -RUN chmod +x docker-entrypoint.sh - -# Expose port -EXPOSE 3000 - -# Remove environment variables file after build -# No need to remove .env as we don't create it - -# Define default command +# Use a specific version of Ubuntu as the base image +FROM ubuntu:24.04 + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive \ + TZ="Etc/UTC" \ + PATH="/root/.local/bin/:$PATH" + +# Install minimal runtime dependencies +RUN apt-get update && \ + apt-get install -y \ + python3 \ + python3-pip \ + python3-venv \ + postgresql-client \ + software-properties-common \ + tzdata \ + ffmpeg \ + curl \ + unzip \ + git && \ + # Add the PPA and install audiowaveform + add-apt-repository ppa:chris-needham/ppa && \ + apt-get update && \ + apt-get install -y audiowaveform && \ + # Install UV + curl -sSL https://astral.sh/uv/install.sh -o /uv-installer.sh && \ + sh /uv-installer.sh && \ + rm /uv-installer.sh && \ + # Install Node.js + curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \ + apt-get install -y nodejs && \ + # Clean up + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy only the files needed for dependency installation and runtime +COPY . . + +# Copy environment variables for initial build +# We use dynamic environment variables at runtime +# No .env file needed during build + +# Install node dependencies and build frontend +RUN npm ci && \ + npm install && \ + npm run build + +# Ensure entrypoint script is executable +RUN chmod +x docker-entrypoint.sh + +# Expose port +EXPOSE 3000 + +# Remove environment variables file after build +# No need to remove .env as we don't create it + +# Define default command + CMD ["./docker-entrypoint.sh"] \ No newline at end of file diff --git a/Dockerfile-cuda128 b/Dockerfile-cuda128 index 42d9b43..b2902ca 100644 --- a/Dockerfile-cuda128 +++ b/Dockerfile-cuda128 @@ -1,62 +1,62 @@ -FROM nvidia/cuda:12.8.0-cudnn-runtime-ubuntu24.04 - -# Set environment variables -ENV DEBIAN_FRONTEND=noninteractive \ - TZ="Etc/UTC" \ - PATH="/root/.local/bin/:$PATH" - -# Install minimal runtime dependencies -RUN apt-get update && \ - apt-get install -y \ - python3 \ - python3-pip \ - python3-venv \ - postgresql-client \ - software-properties-common \ - tzdata \ - ffmpeg \ - curl \ - unzip \ - git && \ - # Add the PPA and install audiowaveform - add-apt-repository ppa:chris-needham/ppa && \ - apt-get update && \ - apt-get install -y audiowaveform && \ - # Install UV - curl -sSL https://astral.sh/uv/install.sh -o /uv-installer.sh && \ - sh /uv-installer.sh && \ - rm /uv-installer.sh && \ - # Install Node.js - curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \ - apt-get install -y nodejs && \ - # Clean up - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set working directory -WORKDIR /app - - -# Copy files to container -COPY . . - -# Copy environment variables for initial build -# We use dynamic environment variables at runtime -# No .env file needed during build - -# Install node dependencies and build frontend -RUN npm ci && \ - npm install && \ - npm run build - -# Ensure entrypoint script is executable -RUN chmod +x docker-entrypoint.sh - -# Expose port -EXPOSE 3000 - -# Remove environment variables file after build -# No need to remove .env as we don't create it - -# Define default command +FROM nvidia/cuda:12.8.0-cudnn-runtime-ubuntu24.04 + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive \ + TZ="Etc/UTC" \ + PATH="/root/.local/bin/:$PATH" + +# Install minimal runtime dependencies +RUN apt-get update && \ + apt-get install -y \ + python3 \ + python3-pip \ + python3-venv \ + postgresql-client \ + software-properties-common \ + tzdata \ + ffmpeg \ + curl \ + unzip \ + git && \ + # Add the PPA and install audiowaveform + add-apt-repository ppa:chris-needham/ppa && \ + apt-get update && \ + apt-get install -y audiowaveform && \ + # Install UV + curl -sSL https://astral.sh/uv/install.sh -o /uv-installer.sh && \ + sh /uv-installer.sh && \ + rm /uv-installer.sh && \ + # Install Node.js + curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \ + apt-get install -y nodejs && \ + # Clean up + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy files to container +COPY . . + +# Copy environment variables for initial build +# We use dynamic environment variables at runtime +# No .env file needed during build + +# Install node dependencies and build frontend + +RUN npm ci && \ + npm install && \ + npm run build + +# Ensure entrypoint script is executable +RUN chmod +x docker-entrypoint.sh + +# Expose port +EXPOSE 3000 + +# Remove environment variables file after build +# No need to remove .env as we don't create it + +# Define default command CMD ["./docker-entrypoint.sh"] \ No newline at end of file diff --git a/LICENSE b/LICENSE index b095a91..8b46d4b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Rishikanth Chandrasekaran +Copyright (c) 2025 Rishikanth Chandrasekaran Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 48ff4da..3d61b6f 100644 --- a/README.md +++ b/README.md @@ -131,13 +131,13 @@ If you wish to build the Docker images yourself, you can use the provided `Docke #### CPU Image ```bash -docker build -t scriberr:latest -f Dockerfile . +docker build -t scriberr:main -f Dockerfile . ``` #### GPU Image ```bash -docker build -t scriberr:latest-gpu -f Dockerfile-cuda128 . +docker build -t scriberr:main-cuda128 -f Dockerfile-cuda128 . ``` ### Advanced Configuration diff --git a/docker-compose.gpu.yml b/docker-compose.gpu.yml index 04be4d9..f99b237 100644 --- a/docker-compose.gpu.yml +++ b/docker-compose.gpu.yml @@ -4,12 +4,12 @@ services: app: build: context: . - dockerfile: Dockerfile-gpu + dockerfile: Dockerfile-cuda128 # You can find your architecture by running: nvidia-smi if on linux # You can find your architecture by running: system_profiler SPDisplaysDataType if on mac # You can find your architecture by running: wmic path win32_videocontroller get name if on windows # You will need to change the image to match your architecture, E.G. "main-cuda-11" - image: ghcr.io/rishikanthc/scriberr:main-cuda-11 + image: ghcr.io/rishikanthc/scriberr:main-cuda128 deploy: resources: reservations: diff --git a/docker-compose.yml b/docker-compose.yml index 735552c..3d59cfc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,12 +9,19 @@ services: # No args needed as environment variables are passed at runtime env_file: - .env + environment: + - DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} ports: - "${PORT:-3000}:3000" volumes: - scriberr_data:/scriberr networks: - app-network + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"] + interval: 30s + timeout: 10s + retries: 5 depends_on: db: condition: service_healthy @@ -31,7 +38,7 @@ services: volumes: - postgres_data:/var/lib/postgresql/data healthcheck: - test: ["CMD-SHELL", "pg_isready -U root -d local"] + test: ["CMD-SHELL", "pg_isready -U root -d ${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 5 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4a1b65b..b13d278 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -26,7 +26,7 @@ wait_for_db() { echo "Waiting for database to be ready..." echo "Current DATABASE_URL: $DATABASE_URL" - until PGPASSWORD="$POSTGRES_PASSWORD" pg_isready -h db -p 5432 -U "$POSTGRES_USER" -d "$POSTGRES_DB" + until PGPASSWORD="$POSTGRES_PASSWORD" pg_isready -h $POSTGRES_HOST -p 5432 -U "$POSTGRES_USER" -d "$POSTGRES_DB" do echo "Database connection attempt failed. Retrying in 2 seconds..." sleep 2 @@ -77,7 +77,7 @@ install_dependencies() { # Install PyTorch based on hardware if [ "$HARDWARE_ACCEL" = "cuda" ]; then - uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126 + uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 uv pip install nvidia-cudnn-cu11==8.9.6.50 echo "PyTorch with CUDA installed." else diff --git a/env.example b/env.example index 8eeaae7..5376c49 100644 --- a/env.example +++ b/env.example @@ -7,8 +7,11 @@ PORT=3000 # Port to use for running the web interface POSTGRES_PORT=5432 # Port to use for PostgreSQL database POSTGRES_USER=root # Username for PostgreSQL database POSTGRES_PASSWORD=mysecretpassword # Password for PostgreSQL database +POSTGRES_HOST=db # Hostname for PostgreSQL database POSTGRES_DB=local # Database name -DATABASE_URL=postgres://root:mysecretpassword@db:5432/local # Database URL for connection to PostgreSQL database with credentials from above + +# Made using the variables from above. Will be removed in later versions. +# DATABASE_URL=postgres://root:mysecretpassword@db:5432/local # Database URL for connection to PostgreSQL database with credentials from above # Application configuration ADMIN_USERNAME=admin # Username for admin user in web interface diff --git a/transcript.json b/transcript.json deleted file mode 100644 index 0ebe1cf..0000000 --- a/transcript.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "segments": [ - { - "text": " Más monos, sabes lo que me he dicho hoy. Profes, te he hecho un dibujo y me he enseñado un trozo de papel donde supuestamente salgo yo, imagínate. Un churro de color violeta que pone Sofia. Sí. No, mañana voy a ir, voy a comprar un marco y lo voy a colgar en casa. No, míguenlo, creo que le importe. No se fijan las paredes. Está todo el día con el ordenador. Sí, sí, viene hoy.", - "start": 63.582, - "end": 92.692 - }, - { - "text": " Pues es que me parecía cuti de hacer una cena rápida, así que he pensado. Compre una dorada y hago una dorada a la sal que le encanta y es más fácil de hacer que un guiso. Sí. Ana, perdona, que es que no te estaba escuchando.", - "start": 94.143, - "end": 112.115 - }, - { - "text": " Sofía, soy Miguel. Si estás en casa, por favor, coge el teléfono. Es urgente que... Ana, ¿te importa que te llame en un momento? No, no, estoy bien. Venga, vale, hasta luego. Sofía, soy Miguel. Si estás en casa, por favor, coge el teléfono. Es urgente que hablemos. ¿No estás?", - "start": 122.898, - "end": 150.742 - }, - { - "text": " Sofía, Dios, no sé cómo decirte esto. No, no voy a volver a casa. Ni esta noche ni ninguna otra. Es que tú no te das cuenta, pero necesito que me des algo de tiempo. Porque tengo que pensar, aunque sé que puede que no lo merezca, pero no quiero volver. Tú no te das cuenta. Estás con tus niños y tus plantas. Durante meses he pensado en que podíamos intentar salvarlo a nuestro. Pero no es verdad. No quiero ser un imaduro y lo he sido mucho tiempo para horno decirte lo que pensaba.", - "start": 153.172, - "end": 180.475 - }, - { - "text": " Ahora creedás que soy un cerdo, claro. Yo lo pensaría, pero pronto habrás hecho tu vida a la margen de mí. Yo lo necesito. Necesito marcharme, salir de esa casa. Ahora te he hecho de menos, pero... pero pasará. Ya no te quiero. No quiero salvar lo que queda de nosotros. Siento... siento no tener fuerza para decirte esto a la cara. Pero si lo hablamos, me quedo. Me quedo y... no quiero quedarme.", - "start": 180.88, - "end": 207.003 - }, - { - "text": " Hola, Sofía, soy yo. ¿Sabes ya cuándo vas a venir? Los niños me preguntan por ti. Bueno, luego te vuelvo a llamar. Un beso. Hola, Sofía. Llámame en cuanto puedas. Pero llámame, por favor. Estoy preocupada. Sofía, soy Ana. Mira, te llamo por la escuela. ¿Tienes que pedir una baja por depresión? No, no sé. Pero no puedes seguir sin venir y no decir nada. En Juan Carlos estamos quedadísimos. Yo le echo que estás enferma, pero ya sabes cómo es. Además, tendría bien volver a trabajar y salir un poco, ¿no? Bueno, llámame cuando puedas. Un beso.", - "start": 223.608, - "end": 253.493 - }, - { - "text": " Sofía, soy Miguel. Si estás en casa, por favor, coge el teléfono a su gente que hablemos. ¿No estás? Sofía, Dios, no sé cómo decirte esto. No, no voy a volver a casa. Ni esta noche, ni ninguna otra. Es que... tú no te das cuenta, pero necesito que me des algo de tiempo. Porque tengo que pensar, aunque sé que puede, que no lo me des el cambio. No quiero volver. Tú no te das cuenta de estas cuentos niños y tus plantas...", - "start": 254.658, - "end": 279.903 - }, - { - "text": " y no", - "start": 290.095, - "end": 292.897 - }, - { - "text": " Sofía, soy Miguel. Sofía, necesito volver a casa esta noche. Durante meses he pensado en salvarlo a nuestro. Necesito volver a... No quiero ser un imán. Lo he sido mucho tiempo por no decir lo que pensaba. Te quiero. No habrás hecho tu vida a la margen de mí, pero necesito volver a casa. Te quiero. Quiero salvar lo que queda de nosotros. Te quiero. Siento no tener fuerza para decir esto a la cara. Te quiero, te quiero. No.", - "start": 335.506, - "end": 362.557 - }, - { - "text": " Y tu nombre la suena, tus ojos se alejo en lleno de más. Sin ti soy más grande, todo por delante, todo me espera. Pasan los días, descubro la magia de caminar, sin ti soy más grande.", - "start": 363.046, - "end": 377.17 - }, - { - "text": " que era hoy.", - "start": 432.487, - "end": 434.326 - } - ], - "language": "es" -} \ No newline at end of file