| FROM ghcr.io/chenyme/grok2api:latest | |
| # Switch back to root to perform permission modifications | |
| USER root | |
| # Expose default HuggingFace port | |
| ENV SERVER_PORT=7860 | |
| EXPOSE 7860 | |
| # Add entrypoint script | |
| COPY start.sh /app/start.sh | |
| RUN chmod +x /app/start.sh | |
| # Ensure permission compatibility with HuggingFace Space | |
| # Runs as UID 1000 so data & logs must be writable | |
| RUN mkdir -p /app/data /app/logs && chmod -R 777 /app/data /app/logs | |
| # Force HF user explicitly for safety | |
| USER 1000 | |
| # Override the original entrypoint and command to run our start script | |
| ENTRYPOINT [] | |
| CMD ["/app/start.sh"] | |