# ---- Build Stage ---- FROM node:20-slim AS builder WORKDIR /app # Install system tools required for node-gyp (better-sqlite3) and git RUN apt-get update && apt-get install -y git python3 make g++ && rm -rf /var/lib/apt/lists/* RUN npm install -g bun # Clone the official AionUi repository RUN git clone https://github.com/iOfficeAI/AionUi.git . # Build the application using the project's own scripts RUN bun install RUN bun run build:renderer:web RUN node scripts/build-server.mjs # ---- Runtime Stage ---- FROM oven/bun:latest AS runtime WORKDIR /app # Copy built artifacts and package.json from the builder COPY --from=builder /app/dist-server ./dist-server COPY --from=builder /app/out/renderer ./out/renderer COPY --from=builder /app/package.json ./ # Hugging Face specific environment configuration ENV PORT=7860 ENV NODE_ENV=production ENV ALLOW_REMOTE=true ENV DATA_DIR=/data # Create data directory for SQLite persistence RUN mkdir -p /data EXPOSE 7860 # Start the server CMD ["bun", "dist-server/server.mjs"]