fp/services/our/Dockerfile
CJ_Clippy 1c2a4fdd94
Some checks failed
ci / test (push) Failing after 1m49s
ci / build (push) Successful in 12m21s
use builtkit cache for pat
2025-09-26 20:51:15 -08:00

90 lines
2.4 KiB
Docker

# Use ultralytics (YOLO) as base image
FROM ultralytics/ultralytics:8.3.203-cpu 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
# 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
# Copy the rest of the app code
COPY . .
# Build the node app
RUN npm run build
# Set working directory
WORKDIR /app
# 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
# Expose the port
EXPOSE 5000
# Start the app
CMD ["npm", "run", "start:server"]