refactor: simplify build system and improve model loading flexibility
- Remove Rollup bundling in favor of direct TypeScript compilation - Move from bundled models to dynamic model loading with configurable paths - Add Docker deployment examples and documentation - Implement robust model loader with fallback mechanisms - Update storage adapters for better cross-environment compatibility - Add comprehensive tests for model loading and package installation - Simplify package.json scripts and remove complex build configurations - Clean up deprecated demo files and old bundling scripts BREAKING CHANGE: Models are no longer bundled with the package. They are now loaded dynamically from CDN or custom paths.
This commit is contained in:
parent
89413ebec2
commit
52a43d51d4
51 changed files with 4835 additions and 8007 deletions
28
examples/cloud-deployments/aws-lambda/Dockerfile
Normal file
28
examples/cloud-deployments/aws-lambda/Dockerfile
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# AWS Lambda Dockerfile with Auto-Extracted Models
|
||||
# Uses AWS Lambda base image
|
||||
|
||||
FROM public.ecr.aws/lambda/nodejs:24
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies including @soulcraft/brainy-models
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
|
||||
# Copy source code and scripts
|
||||
COPY . .
|
||||
|
||||
# Extract models using our automatic script
|
||||
RUN node scripts/extract-models.js
|
||||
|
||||
# Clean up to reduce layer size
|
||||
RUN rm -rf node_modules/@soulcraft/brainy-models/node_modules \
|
||||
rm -rf node_modules/@soulcraft/brainy-models/.git* \
|
||||
npm cache clean --force
|
||||
|
||||
# Set environment variables
|
||||
ENV NODE_ENV=production
|
||||
ENV AWS_LAMBDA_EXEC_WRAPPER=/opt/bootstrap
|
||||
|
||||
# AWS Lambda expects the handler at the root level
|
||||
CMD ["index.handler"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue