use builtkit cache for pat
Some checks failed
ci / test (push) Failing after 1m49s
ci / build (push) Successful in 12m21s

This commit is contained in:
CJ_Clippy 2025-09-26 20:51:15 -08:00
parent 304683ed1a
commit 1c2a4fdd94
2 changed files with 17 additions and 43 deletions

View File

@ -1,10 +1,11 @@
# build off of YOLO # Use ultralytics (YOLO) as base image
FROM ultralytics/ultralytics:8.3.203-cpu AS base 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 # Get NodeJS & npm
COPY --from=node:22 /usr/local/bin /usr/local/bin 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 COPY --from=node:22 /usr/local/lib/node_modules /usr/local/lib/node_modules
@ -12,18 +13,20 @@ COPY --from=node:22 /usr/local/lib/node_modules /usr/local/lib/node_modules
# Set working directory # Set working directory
WORKDIR /app WORKDIR /app
# Install system-level dependencies required only for building # Install system-level dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update -y && \ apt-get update -y && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
build-essential \ build-essential \
inotify-tools \ inotify-tools \
&& apt-get clean && rm -rf /var/lib/apt/lists/* ffmpeg \
wget
# Copy and install node package dependencies # Copy and install node package dependencies
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN npm install --ignore-scripts=false --foreground-scripts --verbose RUN --mount=type=cache,target=/root/.npm npm install --ignore-scripts=false --foreground-scripts --verbose
# Copy Prisma schema and generate client # Copy Prisma schema and generate client
COPY prisma ./prisma COPY prisma ./prisma
@ -32,34 +35,24 @@ RUN npx prisma generate
# Copy the rest of the app code # Copy the rest of the app code
COPY . . COPY . .
# Build the app # Build the node app
RUN npm run build 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 # Set working directory
WORKDIR /app 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 # 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 \ RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system vcsi uv pip install --system vcsi
@ -67,22 +60,14 @@ RUN --mount=type=cache,target=/root/.cache/uv \
# Install Shaka Packager # Install Shaka Packager
ADD https://github.com/shaka-project/shaka-packager/releases/download/v3.4.2/packager-linux-x64 /usr/local/bin/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 # Install IPFS Kubo
COPY --from=ipfs/kubo:v0.36.0 /usr/local/bin/ipfs /usr/local/bin/ipfs COPY --from=ipfs/kubo:v0.36.0 /usr/local/bin/ipfs /usr/local/bin/ipfs
# Bundle the vibeui pytorch model # Bundle the vibeui pytorch model
RUN mkdir -p /app/vibeui \ ADD https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/vibeui.pt /app/vibeui/vibeui.pt
&& wget -q https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/vibeui.pt -O /app/vibeui/vibeui.pt \ ADD https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/data.yaml /app/vibeui/data.yaml
&& wget -q https://gitea.futureporn.net/futureporn/fp/raw/branch/main/apps/vibeui/public/data.yaml -O /app/vibeui/data.yaml
# Install openwhisper # Install openwhisper
COPY --from=ghcr.io/ggml-org/whisper.cpp:main-e7bf0294ec9099b5fc21f5ba969805dfb2108cea /app /app/whisper.cpp COPY --from=ghcr.io/ggml-org/whisper.cpp:main-e7bf0294ec9099b5fc21f5ba969805dfb2108cea /app /app/whisper.cpp
@ -96,17 +81,6 @@ RUN \
chmod +x /usr/local/bin/packager && \ chmod +x /usr/local/bin/packager && \
ipfs init 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 the port
EXPOSE 5000 EXPOSE 5000

View File

@ -1,7 +1,7 @@
{ {
"name": "futureporn-our", "name": "futureporn-our",
"private": true, "private": true,
"version": "2.8.17", "version": "2.8.18",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "concurrently npm:dev:serve npm:dev:build:server npm:dev:build:client npm:dev:worker npm:dev:compose npm:dev:sftp npm:dev:qbittorrent npm:dev:tailscale", "dev": "concurrently npm:dev:serve npm:dev:build:server npm:dev:build:client npm:dev:worker npm:dev:compose npm:dev:sftp npm:dev:qbittorrent npm:dev:tailscale",