Skip to content

Commit

Permalink
non working dockerfile and down for maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
noahgsolomon committed Nov 3, 2024
1 parent 7de3fc9 commit 33f4aa9
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 57 deletions.
134 changes: 96 additions & 38 deletions generate/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
FROM python:3.9

# Add retry logic and multiple mirrors for more reliable package installation
# Configure apt for reliability
RUN echo 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries && \
echo "deb http://deb.debian.org/debian bookworm main\ndeb http://deb.debian.org/debian-security bookworm-security main\ndeb http://deb.debian.org/debian bookworm-updates main" > /etc/apt/sources.list
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90assume-yes && \
echo 'Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/99compression-workaround

# Install Node.js with proper repository setup
RUN apt-get update && apt-get install -y ca-certificates curl gnupg && \
RUN rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
apt-get update --fix-missing && \
apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y nodejs && \
npm install -g npm@latest

# Install system dependencies with retry logic
RUN apt-get update && apt-get clean && \
for i in $(seq 1 3); do \
apt-get update && \
# Install system dependencies with retry mechanism
RUN for i in {1..3}; do \
apt-get update --fix-missing && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ffmpeg \
vim \
wget \
ca-certificates \
lsb-release \
xdg-utils \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
Expand All @@ -37,59 +56,98 @@ RUN apt-get update && apt-get clean && \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
break || \
if [ $i -lt 3 ]; then sleep 5; fi; \
libstdc++6 && break || \
if [ $i -lt 3 ]; then \
sleep 5; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
fi; \
done

# Install ffmpeg and its dependencies with retry mechanism
RUN for i in {1..3}; do \
apt-get update --fix-missing && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ffmpeg \
libavutil57 \
libavcodec59 \
libavformat59 \
libavdevice59 \
libavfilter8 \
libswscale6 \
libswresample4 \
libpostproc56 && \
ldconfig && \
ffmpeg -version && break || \
if [ $i -lt 3 ]; then \
sleep 5; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
fi; \
done && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*


RUN apt-get update && \
apt-get install -y ffmpeg && \
apt-get install -y software-properties-common && \
apt-get install -y wget && \
wget -O /etc/apt/trusted.gpg.d/debian-multimedia.gpg https://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb && \
echo "deb http://www.deb-multimedia.org stable main" | tee /etc/apt/sources.list.d/multimedia.list && \
apt-get update -oAcquire::AllowInsecureRepositories=true && \
apt-get install -y --allow-unauthenticated deb-multimedia-keyring && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ffmpeg \
libavutil57 \
libavcodec59 \
libavformat59 \
libavdevice59 \
libavfilter8 \
libswscale6 \
libswresample4 \
libpostproc56 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
ldconfig && \
ffmpeg -version

# Set up Python environment
RUN python3 -m pip install --upgrade pip

WORKDIR /app/brainrot

# Install Python dependencies
COPY requirements.txt /app/brainrot/
RUN cd /app/brainrot/ && pip3 install -r requirements.txt
RUN pip3 install -r requirements.txt

# Install whisper_timestamped
COPY setup.py /app/brainrot/setup.py
COPY whisper_timestamped /app/brainrot/whisper_timestamped
RUN pip3 install ".[dev]"

RUN cd /app/brainrot/ && pip3 install ".[dev]"

# Install PyTorch CPU version
RUN pip3 install \
torch==1.13.1 \
torchaudio==0.13.1 \
--extra-index-url https://download.pytorch.org/whl/cpu

# Install Gunicorn
RUN pip3 install gunicorn

# Copy application code
COPY . /app/brainrot

RUN npm install pm2 -g
RUN npm install

RUN npm install -g browserslist caniuse-lite && \
# Install Node.js dependencies
RUN npm install pm2 -g && \
npm install && \
npm install -g browserslist caniuse-lite && \
npm update -g caniuse-lite

# Verify audio directory exists and has proper permissions
RUN mkdir -p /app/brainrot/public/voice && \
chmod -R 755 /app/brainrot/public

# Set up Gunicorn
ENTRYPOINT ["gunicorn"]
CMD ["-w", "1", "-b", "0.0.0.0:5000", "--access-logfile", "access.log", "--error-logfile", "error.log", "transcribe:app", "--daemon", "--timeout", "120"]
CMD ["transcribe:app", "-w", "1", "-b", "0.0.0.0:5000", "--access-logfile", "access.log", "--error-logfile", "error.log", "--timeout", "120"]
36 changes: 19 additions & 17 deletions src/app/page-client.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";

import { Button } from "@/components/ui/button";
import { Button, buttonVariants } from "@/components/ui/button";
import { useCreateVideo } from "./usecreatevideo";
import { useYourVideos } from "./useyourvideos";
import { useEffect, useState } from "react";
import { toast } from "sonner";
import { Crown, Folder, Loader2, Wand, X } from "lucide-react";
import { Crown, Folder, Loader2, Star, Wand, X } from "lucide-react";
import { useUser } from "@clerk/nextjs";
import { Skeleton } from "@/components/ui/skeleton";
import { trpc } from "@/trpc/client";
Expand All @@ -17,6 +17,7 @@ import { currentUser } from "@clerk/nextjs/server";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import ClientTweetCard from "@/components/magicui/client-tweet-card";
import { Card } from "@/components/ui/card";
import Link from "next/link";

export default function PageClient({
searchParams,
Expand Down Expand Up @@ -215,30 +216,31 @@ export default function PageClient({
</div>
</div>
)}
<p className="text-base font-bold text-red-500/80">Down until Nov. 8</p>
<div className="flex flex-col gap-2">
<Button
className="flex flex-row items-center gap-2"
variant={"brain"}
size={"lg"}
disabled={pendingVideo}
disabled={pendingVideo || true}
onClick={() => {
setIsOpen(true);
}}
>
<Wand className="h-4 w-4" /> Create Video
</Button>
{/* <Link
href={"https://github.com/noahgsolomon/brainrot.js"}
target="_blank"
className={buttonVariants({
className: "flex flex-row items-center gap-2",
size: "lg",
variant: "outline",
})}
>
<Star className="h-4 w-4 " />
Star on GitHub
</Link> */}
<Link
href={"https://github.com/noahgsolomon/brainrot.js"}
target="_blank"
className={buttonVariants({
className: "flex flex-row items-center gap-2",
size: "lg",
variant: "outline",
})}
>
<Star className="h-4 w-4 " />
Star on GitHub
</Link>
{/* <Link
href={"/watch"}
className={buttonVariants({
Expand Down Expand Up @@ -272,15 +274,15 @@ export default function PageClient({

{clerkUser?.id ? (
<>
<Credits />
{/* <Credits />
<Button
variant={"outline"}
className="flex flex-row items-center gap-2 "
onClick={() => setIsYourVideosOpen(true)}
>
<Folder className="h-4 w-4" />
Your videos
</Button>
</Button> */}
</>
) : null}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default async function Home({
{/* Add the following block */}
</div>

{userDB && userDB?.user ? (
{/* {userDB && userDB?.user ? (
<Card
className={` ${
!userDB?.user?.subscribed
Expand Down Expand Up @@ -160,7 +160,7 @@ export default async function Home({
</div>
</CardContent>
</Card>
) : null}
) : null} */}
<PageClient
searchParams={searchParams}
initialPendingVideo={pendingVideo}
Expand Down

0 comments on commit 33f4aa9

Please sign in to comment.