Spaces:
Paused
Paused
| FROM node:24-slim AS base | |
| ENV PNPM_HOME="/pnpm" | |
| ENV PATH="$PNPM_HOME:$PATH" | |
| RUN corepack enable | |
| FROM base AS builder | |
| WORKDIR /build | |
| # Copy LICENSE file. | |
| COPY LICENSE ./ | |
| # Copy the relevant package.json and package-lock.json files. | |
| COPY package*.json ./ | |
| COPY packages/server/package*.json ./packages/server/ | |
| COPY packages/core/package*.json ./packages/core/ | |
| COPY packages/frontend/package*.json ./packages/frontend/ | |
| COPY packages/seanime-extensions/package*.json ./packages/seanime-extensions/ | |
| COPY pnpm-workspace.yaml ./pnpm-workspace.yaml | |
| COPY pnpm-lock.yaml ./pnpm-lock.yaml | |
| COPY patches ./patches | |
| # Install dependencies. | |
| RUN pnpm install --frozen-lockfile | |
| # Copy source files. | |
| COPY tsconfig.*json ./ | |
| COPY packages/server ./packages/server | |
| COPY packages/core ./packages/core | |
| COPY packages/frontend ./packages/frontend | |
| COPY packages/seanime-extensions ./packages/seanime-extensions | |
| COPY scripts ./scripts | |
| COPY resources ./resources | |
| # Build the project. | |
| RUN pnpm run build | |
| # Remove development dependencies. | |
| RUN rm -rf node_modules | |
| RUN rm -rf packages/core/node_modules | |
| RUN rm -rf packages/server/node_modules | |
| RUN rm -rf packages/frontend/node_modules | |
| RUN rm -rf packages/seanime-extensions/node_modules | |
| RUN pnpm install --prod --frozen-lockfile | |
| FROM builder AS runtime | |
| WORKDIR /runtime | |
| # Hugging Face Spaces / Koyeb use $PORT (default 7860 on HF, 8000 on Koyeb). | |
| # Keep 3000 as a fallback for local Docker runs. | |
| ENV PORT=${PORT:-3000} | |
| EXPOSE ${PORT} | |
| # Copy the built files from the builder. | |
| # The package.json files must be copied as well for pnpm workspace symlinks between local packages to work. | |
| COPY --from=builder /build/package*.json /build/LICENSE ./ | |
| COPY --from=builder /build/pnpm-workspace.yaml ./pnpm-workspace.yaml | |
| COPY --from=builder /build/pnpm-lock.yaml ./pnpm-lock.yaml | |
| COPY --from=builder /build/patches ./patches | |
| COPY --from=builder /build/packages/core/package.*json ./packages/core/ | |
| COPY --from=builder /build/packages/server/package.*json ./packages/server/ | |
| COPY --from=builder /build/packages/core/dist ./packages/core/dist | |
| COPY --from=builder /build/packages/frontend/dist ./packages/frontend/dist | |
| COPY --from=builder /build/packages/server/dist ./packages/server/dist | |
| COPY --from=builder /build/packages/server/src/static ./packages/server/dist/static | |
| COPY --from=builder /build/packages/seanime-extensions/dist ./packages/seanime-extensions/dist | |
| COPY --from=builder /build/resources ./resources | |
| COPY --from=builder /build/scripts ./scripts | |
| COPY --from=builder /build/node_modules ./node_modules | |
| COPY --from=builder /build/packages/core/node_modules ./packages/core/node_modules | |
| COPY --from=builder /build/packages/server/node_modules ./packages/server/node_modules | |
| # Use a regular Node image for the final stage instead of distroless so that | |
| # Hugging Face Spaces / Koyeb and any shell-based health checks work out of the box. | |
| FROM node:24-slim AS production | |
| LABEL org.opencontainers.image.title="AIOStreams" | |
| LABEL org.opencontainers.image.source="https://github.com/Viren070/AIOStreams" | |
| LABEL org.opencontainers.image.description="AIOStreams consolidates multiple Stremio addons and debrid services - including its own suite of built-in addons - into a single, highly customisable super-addon." | |
| LABEL org.opencontainers.image.licenses="GPL-3.0" | |
| WORKDIR /app | |
| COPY --from=runtime /runtime /app | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ | |
| CMD node -e "require('http').get('http://localhost:'+(process.env.PORT||3000)+'/api/v1/health', (r)=>{process.exit(r.statusCode===200?0:1)}).on('error', ()=>process.exit(1))" | |
| CMD ["node", "/app/packages/server/dist/server.js"] | |