mini-world / Dockerfile
victor's picture
victor HF Staff
fix: install dependencies as root then chown to bun user
e207c78 verified
raw
history blame contribute delete
656 Bytes
# Use official Bun image
FROM oven/bun:1-alpine AS base
# Set working directory and ensure bun user owns it
WORKDIR /home/bun/app
# Copy package files first for better caching (as root for now)
COPY package.json bun.lockb ./
# Install dependencies as root (to avoid permission issues)
RUN bun install --frozen-lockfile --production
# Copy application files
COPY . .
# Change ownership to bun user (UID 1000 for HF Spaces)
RUN chown -R bun:bun /home/bun/app
# Switch to bun user
USER bun
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Set default port for Hugging Face Spaces
ENV PORT=7860
# Run the server
CMD ["bun", "server.ts"]