89 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
# Use ultralytics (YOLO) as base image
 | 
						|
FROM ultralytics/ultralytics:8.3.203 AS base
 | 
						|
 | 
						|
# prevent docker-clean apt rules from deleting our cache
 | 
						|
RUN rm -f /etc/apt/apt.conf.d/docker-clean
 | 
						|
 | 
						|
# Get NodeJS & npm
 | 
						|
COPY --from=node:22 /usr/local/bin /usr/local/bin
 | 
						|
COPY --from=node:22 /usr/local/lib/node_modules /usr/local/lib/node_modules
 | 
						|
 | 
						|
 | 
						|
 | 
						|
# Set working directory
 | 
						|
WORKDIR /app
 | 
						|
 | 
						|
# Install system-level dependencies
 | 
						|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
 | 
						|
    --mount=type=cache,target=/var/lib/apt,sharing=locked \
 | 
						|
    apt-get update -y && \
 | 
						|
    apt-get install -y --no-install-recommends \
 | 
						|
        build-essential \
 | 
						|
        inotify-tools \
 | 
						|
        ffmpeg \
 | 
						|
        wget
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
# Install pip dependencies
 | 
						|
# we are avoiding installing using requirements.txt file because doing so with ultralytics would install 7GB worth of unecessary dependencies.
 | 
						|
RUN --mount=type=cache,target=/root/.cache/uv \
 | 
						|
    uv pip install --system vcsi
 | 
						|
 | 
						|
 | 
						|
    # Install Shaka Packager
 | 
						|
ADD https://github.com/shaka-project/shaka-packager/releases/download/v3.4.2/packager-linux-x64 /usr/local/bin/packager
 | 
						|
 | 
						|
 | 
						|
# Install IPFS Kubo
 | 
						|
COPY --from=ipfs/kubo:v0.36.0 /usr/local/bin/ipfs /usr/local/bin/ipfs
 | 
						|
 | 
						|
 | 
						|
# Bundle the vibeui pytorch model
 | 
						|
ADD https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/vibeui.pt /app/vibeui/vibeui.pt
 | 
						|
ADD https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/data.yaml /app/vibeui/data.yaml
 | 
						|
 | 
						|
# Install openwhisper
 | 
						|
COPY --from=ghcr.io/ggml-org/whisper.cpp:main-e7bf0294ec9099b5fc21f5ba969805dfb2108cea /app /app/whisper.cpp
 | 
						|
ENV PATH="$PATH:/app/whisper.cpp/build/bin"
 | 
						|
ENV LD_LIBRARY_PATH="/app/whisper.cpp/build/src:/app/whisper.cpp/build/ggml/src:/usr/local/lib:/usr/lib"
 | 
						|
 | 
						|
# Install b2-cli & initialize misc
 | 
						|
ADD https://github.com/Backblaze/B2_Command_Line_Tool/releases/download/v4.4.1/b2-linux /usr/local/bin/b2
 | 
						|
RUN \
 | 
						|
    chmod +x /usr/local/bin/b2 && \
 | 
						|
    chmod +x /usr/local/bin/packager && \
 | 
						|
    ipfs init
 | 
						|
 | 
						|
 | 
						|
 | 
						|
# Copy and install node package dependencies
 | 
						|
COPY package.json package-lock.json ./
 | 
						|
RUN --mount=type=cache,target=/root/.npm npm install --ignore-scripts=false --foreground-scripts --verbose
 | 
						|
 | 
						|
# Copy Prisma schema and generate client
 | 
						|
COPY prisma ./prisma
 | 
						|
RUN npx prisma generate
 | 
						|
 | 
						|
RUN --mount=type=cache,target=/root/.npm \
 | 
						|
    --mount=type=cache,target=/app/node_modules \
 | 
						|
    npm install --ignore-scripts=false --foreground-scripts --verbose && \
 | 
						|
    npx prisma generate
 | 
						|
 | 
						|
 | 
						|
# Copy the rest of the app code
 | 
						|
COPY . .
 | 
						|
 | 
						|
# Build the node app
 | 
						|
RUN npm run build
 | 
						|
 | 
						|
 | 
						|
# Expose the port
 | 
						|
EXPOSE 5000
 | 
						|
 | 
						|
# Start the app
 | 
						|
CMD ["npm", "run", "start:server"]
 | 
						|
 |