# Flux Studio — Zero GPU # Hugging Face Docker Space · free CPU tier · no GPU needed. # All image generation is proxied to the Black Forest Labs FLUX API. # Pinned Node LTS (as required: explicit Node major, reproducible builds). FROM node:20-slim # Hugging Face Spaces runs containers as user 1000. RUN useradd -m -u 1000 user \ && mkdir -p /app && chown -R user:user /app USER user WORKDIR /app # Install dependencies first for better layer caching. # package-lock.json is committed, so `npm ci` is fully reproducible. COPY --chown=user:user package.json package-lock.json ./ RUN npm ci --omit=dev && npm cache clean --force # App code. COPY --chown=user:user . . # Build-time verification (fails the image build if the app is broken). RUN npm run build ENV NODE_ENV=production \ PORT=7860 \ HOST=0.0.0.0 EXPOSE 7860 # BFL_API_KEY is injected by Hugging Face at runtime (Space Secrets): # BFL_API_KEY (required for generation; app refuses generation without it) # BFL_MODEL_ID (default: flux-2-pro-preview) # BFL_FALLBACK_MODEL_ID (default: flux-2-klein-9b) # BFL_API_BASE_URL (default: https://api.bfl.ai) CMD ["node", "server.mjs"]