# Use official Bun base image | |
FROM oven/bun:1.0.30 | |
# Create non-root user like Hugging Face expects | |
RUN adduser --disabled-password --gecos "" user | |
USER user | |
ENV PATH="/home/user/.bun/bin:$PATH" | |
# Set working directory | |
WORKDIR /app | |
# Copy only dependencies first for caching | |
COPY --chown=user bun.lockb bunfig.toml ./ | |
RUN bun install | |
# Copy the rest of the code | |
COPY --chown=user . . | |
# Port Hugging Face expects | |
EXPOSE 7860 | |
# Run the server (make sure your script listens on port 7860) | |
CMD ["bun", "./src/index.ts"] | |