fp/services/our/Dockerfile
CJ_Clippy 304683ed1a
Some checks failed
ci / test (push) Failing after 3m38s
ci / build (push) Successful in 31m44s
rm onnx
2025-09-26 19:43:27 -08:00

116 lines
3.6 KiB
Docker

# build off of YOLO
FROM ultralytics/ultralytics:8.3.203-cpu AS base
# Get NodeJS
COPY --from=node:22 /usr/local/bin /usr/local/bin
# Get npm
COPY --from=node:22 /usr/local/lib/node_modules /usr/local/lib/node_modules
# Set working directory
WORKDIR /app
# Install system-level dependencies required only for building
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 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy and install node package dependencies
COPY package.json package-lock.json ./
RUN 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 app
RUN npm run build
# we are avoiding installing using requirements.txt file because doing so with ultralytics would install 7GB worth of unecessary dependencies.
# === Runtime stage ===
# FROM node:22-slim AS release
# Set working directory
WORKDIR /app
# ENV PATH="/app/venv/bin:$PATH"
# Install runtime 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 \
ca-certificates \
ffmpeg \
wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install pip 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
# RUN wget -q https://github.com/shaka-project/shaka-packager/releases/download/v3.4.2/packager-linux-x64 \
# -O /usr/local/bin/packager \
# && chmod +x /usr/local/bin/packager \
# && packager --version
# we can't copy from the shaka-packager image because that's an alpine image missing gcc
# COPY --from=google/shaka-packager:v3.4.2 /usr/bin /usr/local/bin
# Install IPFS Kubo
COPY --from=ipfs/kubo:v0.36.0 /usr/local/bin/ipfs /usr/local/bin/ipfs
# Bundle the vibeui pytorch model
RUN mkdir -p /app/vibeui \
&& wget -q https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/vibeui.pt -O /app/vibeui/vibeui.pt \
&& wget -q https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/data.yaml -O /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 runtime artifacts from builder
# COPY --from=builder /app/dist ./dist
# COPY --from=builder /app/node_modules ./node_modules
# COPY --from=builder /app/package.json ./package.json
# COPY --from=builder /app/prisma ./prisma
# COPY --from=builder /app/generated ./generated
# COPY --from=builder /app/src ./src
# COPY --from=builder /app/graphile.config.ts ./graphile.config.ts
# COPY --from=builder /app/crontab ./crontab
# RUN . /app/venv/bin/activate
# Expose the port
EXPOSE 5000
# Start the app
CMD ["npm", "run", "start:server"]