Spaces:
Running
Running
FROM node:20-slim | |
# Install dependencies as root | |
RUN apt-get update && apt-get install -y \ | |
curl unzip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Use existing node user (UID 1000) for Hugging Face Spaces compatibility | |
# The node:20-slim image already has a 'node' user with UID 1000 | |
# Install bun globally | |
RUN curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash | |
ENV PATH="/usr/local/bin:${PATH}" | |
# Set working directory with proper permissions | |
WORKDIR /app | |
RUN chown -R node:node /app | |
# Switch to non-root user | |
USER node | |
# Copy package files and install dependencies | |
COPY --chown=node:node package.json bun.lock* ./ | |
RUN bun install | |
# Copy application files | |
COPY --chown=node:node . . | |
# Create writable directory for Vite temp files | |
RUN mkdir -p /app/.vite && chmod 755 /app/.vite | |
EXPOSE 7860 | |
ENV NODE_ENV=production | |
ENV HOME=/home/node | |
ENTRYPOINT [] | |
CMD ["bun", "run", "dev", "--host", "0.0.0.0", "--port", "7860"] | |