From 07e68cb37ba28679a5170057e9cff071436c79d1 Mon Sep 17 00:00:00 2001 From: CJ_Clippy Date: Tue, 30 Sep 2025 22:50:04 -0800 Subject: [PATCH] move npm build to the end of dockerfile --- services/our/Dockerfile | 43 +++++++++++------------- services/our/Dockerfile.old | 67 ------------------------------------- services/our/package.json | 2 +- 3 files changed, 20 insertions(+), 92 deletions(-) delete mode 100644 services/our/Dockerfile.old diff --git a/services/our/Dockerfile b/services/our/Dockerfile index e22f80c..efb3456 100644 --- a/services/our/Dockerfile +++ b/services/our/Dockerfile @@ -24,30 +24,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ 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 - - @@ -82,8 +58,27 @@ RUN \ ipfs init + +# Copy and install node package dependencies +COPY package.json package-lock.json prisma ./ +RUN --mount=type=cache,target=/root/.npm npm install --ignore-scripts=false --foreground-scripts --verbose + +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"] + diff --git a/services/our/Dockerfile.old b/services/our/Dockerfile.old deleted file mode 100644 index d22d106..0000000 --- a/services/our/Dockerfile.old +++ /dev/null @@ -1,67 +0,0 @@ -FROM node:22 - -# Set working directory -WORKDIR /app - -# Install system-level dependencies -RUN apt-get update -y && \ - apt-get install -y --no-install-recommends \ - build-essential \ - git \ - inotify-tools \ - ffmpeg \ - mktorrent \ - python3 \ - python3-pip \ - python3-venv \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Install Shaka 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 - -# Install IPFS Kubo -COPY --from=ipfs/kubo:v0.36.0 /usr/local/bin/ipfs /usr/local/bin/ipfs -RUN ipfs init - -# 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 -RUN wget https://github.com/Backblaze/B2_Command_Line_Tool/releases/download/v4.4.1/b2-linux -O /usr/local/bin/b2 && chmod +x /usr/local/bin/b2 - -# Copy and install 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 code -COPY . . - -# Build the app -RUN npm run build - -# Setup Python virtualenv -RUN python3 -m venv /app/venv -ENV PATH="/app/venv/bin:$PATH" - -# Install python deps -RUN ./venv/bin/pip install --no-cache-dir -r requirements.txt - -# Expose the port -EXPOSE 5000 - -# Start the app -CMD ["npm", "run", "start:server"] diff --git a/services/our/package.json b/services/our/package.json index 77fd553..6cf26fe 100644 --- a/services/our/package.json +++ b/services/our/package.json @@ -1,7 +1,7 @@ { "name": "futureporn-our", "private": true, - "version": "2.8.28", + "version": "2.8.29", "type": "module", "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",