| # Use Node.js as base | |
| FROM node:20-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy package files | |
| COPY package*.json ./ | |
| # Install dependencies and bore tunnel | |
| RUN apt-get update && apt-get install -y wget curl && \ | |
| wget https://github.com/ekzhang/bore/releases/download/v0.5.1/bore-v0.5.1-x86_64-unknown-linux-musl.tar.gz && \ | |
| tar -xf bore-v0.5.1-x86_64-unknown-linux-musl.tar.gz && \ | |
| mv bore /usr/local/bin/ && \ | |
| rm bore-v0.5.1-x86_64-unknown-linux-musl.tar.gz && \ | |
| npm install | |
| # Copy source code | |
| COPY . . | |
| # Build the frontend | |
| RUN npm run build | |
| # Install tsx globally or ensure it is in devDependencies to run the server | |
| RUN npm install -g tsx | |
| # Expose the default HF Spaces port | |
| EXPOSE 7860 | |
| # Set environment variables | |
| ENV NODE_ENV=production | |
| ENV PORT=7860 | |
| # Start the server | |
| CMD ["tsx", "server.ts"] | |