Spaces:
Paused
Paused
File size: 1,799 Bytes
34367da | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # WidgeTDC Backend - Hugging Face Spaces
# Using node:20-slim (Debian-based) for glibc compatibility with onnxruntime-node
FROM node:20-slim AS builder
# Install OpenSSL for Prisma
RUN apt-get update -y && apt-get install -y openssl libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy root workspace config
COPY package*.json ./
COPY tsconfig.base.json ./
# Copy workspace packages (needed for workspace:* resolution)
COPY packages/domain-types ./packages/domain-types/
COPY packages/mcp-types ./packages/mcp-types/
# Copy backend package.json and prisma
COPY apps/backend/package*.json ./apps/backend/
COPY apps/backend/prisma ./apps/backend/prisma/
# Install dependencies with workspace resolution
RUN npm ci
# Generate Prisma client
RUN cd apps/backend && npx prisma generate
# Copy backend source code and tsconfig
COPY apps/backend/src ./apps/backend/src/
COPY apps/backend/tsconfig.json ./apps/backend/
# Build shared packages first
RUN cd packages/domain-types && npm run build
RUN cd packages/mcp-types && npm run build
# Build backend
RUN cd apps/backend && npm run build-fixed
# Final stage - Debian-based for glibc compatibility
FROM node:20-slim
WORKDIR /app
# Install OpenSSL for Prisma runtime
RUN apt-get update -y && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
# Copy built artifacts
COPY --from=builder /app/apps/backend/dist ./dist
COPY --from=builder /app/apps/backend/package.json ./
COPY --from=builder /app/node_modules ./node_modules
# Copy sql.js WASM file for SQLite fallback
COPY --from=builder /app/node_modules/sql.js/dist/sql-wasm.wasm ./dist/
# Environment
ENV NODE_ENV=production
ENV PORT=7860
EXPOSE 7860
CMD ["node", "dist/index.cjs"]
|