diff --git a/docker/Dockerfile b/docker/Dockerfile index 7f03318c10f6e40191aea8843a33e660e9a126b9..5c24fa93880cead75a898ca21d937be3e7d7054a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -60,7 +60,7 @@ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true ENV CHROME_PATH=/app/chrome-linux/chrome ENV PUPPETEER_EXECUTABLE_PATH=/app/chrome-linux/chrome -RUN echo "Done running arm64 specific installtion steps" +RUN echo "Done running arm64 specific installation steps" ############################################# @@ -129,12 +129,19 @@ RUN yarn build && \ WORKDIR /app # Install server layer & build node-llama-cpp -FROM build AS server-build +# Also pull and build collector deps (chromium issues prevent bad bindings) +FROM build AS backend-build COPY ./server /app/server/ WORKDIR /app/server RUN yarn install --production --network-timeout 100000 && yarn cache clean WORKDIR /app +# Install collector dependencies +COPY ./collector/ ./collector/ +WORKDIR /app/collector +ENV PUPPETEER_DOWNLOAD_BASE_URL=https://storage.googleapis.com/chrome-for-testing-public +RUN yarn install --production --network-timeout 100000 && yarn cache clean + # Compile Llama.cpp bindings for node-llama-cpp for this operating system. # Creates appropriate bindings for the OS USER root @@ -143,24 +150,10 @@ RUN npx --no node-llama-cpp download WORKDIR /app USER anythingllm -# Build collector deps (this also downloads proper chrome for collector in /app/.cache so that needs to be -# transferred properly in prod-build stage. -FROM build AS collector-build -COPY ./collector /app/collector -WORKDIR /app/collector -ENV PUPPETEER_DOWNLOAD_BASE_URL=https://storage.googleapis.com/chrome-for-testing-public -RUN yarn install --production --network-timeout 100000 && yarn cache clean -WORKDIR /app - -FROM build AS production-build +# Since we are building from backend-build we just need to move built frontend into server/public +FROM backend-build AS production-build WORKDIR /app -# Copy the server -COPY --chown=anythingllm:anythingllm --from=server-build /app/server/ /app/server/ -# Copy built static frontend files to the server public directory COPY --chown=anythingllm:anythingllm --from=frontend-build /app/frontend/dist /app/server/public -# Copy the collector -COPY --chown=anythingllm:anythingllm --from=collector-build /app/collector/ /app/collector/ -COPY --chown=anythingllm:anythingllm --from=collector-build /app/.cache/puppeteer /app/.cache/puppeteer # No longer needed? (deprecated) # WORKDIR /app/server