# 1. Pull the image we just pushed to Docker Hub FROM mananjp/tribemind:latest # 2. Switch to root temporarily to adjust ports and permissions USER root # 3. Change Nginx config to listen on port 7860 (required by Hugging Face) RUN sed -i 's/listen 80;/listen 7860;/g' /etc/nginx/conf.d/tribemind.conf # 4. Remove the default "user" directive from nginx.conf since we're not running as root RUN sed -i 's/^user /#user /g' /etc/nginx/nginx.conf || true # 5. ✨ FIX: Redirect supervisord log and pid to /tmp (always writable) RUN sed -i 's|/var/log/supervisord.log|/tmp/supervisord.log|g' /etc/supervisor/conf.d/supervisord.conf && \ sed -i 's|/var/run/supervisord.pid|/tmp/supervisord.pid|g' /etc/supervisor/conf.d/supervisord.conf # 6. Fix permissions for other directories nginx uses RUN mkdir -p /var/cache/nginx /var/log/nginx /var/run/nginx /var/lib/nginx && \ chmod -R 777 /var/cache/nginx /var/log/nginx /var/run /var/lib/nginx /etc/nginx # 7. Switch to the required non-root user for Hugging Face Spaces USER 1000 # 8. Expose the required port EXPOSE 7860 # 9. Start the same supervisord command CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]