| # Use an official n8n image. | |
| # You can pin to a specific version for stability, e.g., n8nio/n8n:1.44.1 | |
| FROM n8nio/n8n:latest | |
| # Set environment variables for n8n | |
| ENV N8N_HOST="0.0.0.0" | |
| ENV N8N_PORT=7860 | |
| ENV GENERIC_TIMEZONE="UTC" | |
| # ENV N8N_DIAGNOSTICS_ENABLED=false | |
| # Tell n8n to automatically enforce correct permissions for its settings file | |
| ENV N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true | |
| # Create a working directory (good practice, though n8n uses /home/node/.n8n for data) | |
| WORKDIR /app | |
| # Copy the startup script into the container and set its permissions. | |
| # Using an absolute path for the destination is a bit more robust. | |
| COPY --chmod=0755 start.sh /app/start.sh | |
| # Expose the port. Hugging Face Spaces will use this port based on the README.md app_port metadata. | |
| EXPOSE 7860 | |
| # Set our start.sh script as the entrypoint. | |
| # This script is responsible for setting up necessary environment variables | |
| # and then executing the main n8n process. | |
| ENTRYPOINT ["/app/start.sh"] | |
| # CMD is not strictly needed here if start.sh takes no arguments, | |
| # or you can leave it as CMD [] if you prefer. | |
| # The base n8n image's CMD would be overridden by this ENTRYPOINT. |