Chat / Dockerfile
kishankrish19's picture
Deploy Stillwave fullstack clean
b0798af
Raw History Blame Contribute Delete
1.24 kB
FROM node:24-bookworm-slim
# Install system build dependencies and runtime tools
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
make \
g++ \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Set up directory ownership for user node (UID 1000)
RUN chown -R node:node /app
# Switch to non-root user (Hugging Face Spaces default UID 1000)
USER node
# 1. Install backend dependencies
COPY --chown=node:node backend/package*.json ./backend/
RUN cd backend && npm ci
# 2. Install frontend dependencies
COPY --chown=node:node frontend/package*.json ./frontend/
RUN cd frontend && npm ci
# 3. Build backend
COPY --chown=node:node backend/ ./backend/
RUN cd backend && npm run build
# 4. Build frontend
COPY --chown=node:node frontend/ ./frontend/
RUN cd frontend && npm run build
# 5. Copy startup script
COPY --chown=node:node start.sh ./start.sh
RUN chmod +x ./start.sh
# 6. Ensure data directories exist and are writable
RUN mkdir -p /app/backend/data /app/backend/downloaded_songs
# HF Spaces communicates over port 7860
EXPOSE 7860
ENV NODE_ENV=production
ENV PORT=5000
ENV HOST=127.0.0.1
ENV API_PROXY_TARGET=http://127.0.0.1:5000
CMD ["./start.sh"]