move npm build to the end of dockerfile
Some checks failed
ci / test (push) Failing after 1m32s
fp/our CI/CD / build (push) Failing after 6m29s

This commit is contained in:
CJ_Clippy 2025-09-30 22:50:04 -08:00
parent 32b6698d23
commit 07e68cb37b
3 changed files with 20 additions and 92 deletions

View File

@ -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"]

View File

@ -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"]

View File

@ -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",