| # Use the official Metabase image | |
| # FROM metabase/metabase:latest | |
| # Use a specific version of Metabase known to be stable | |
| FROM metabase/metabase:latest | |
| WORKDIR /app | |
| # Create custom Log4j2 configuration that drops all log output | |
| # RUN cat <<'EOF' > /app/log4j2.xml | |
| #<?xml version="1.0" encoding="UTF-8"?> | |
| #<Configuration status="WARN"> | |
| # <Appenders> | |
| # <Null name="Null"/> | |
| # </Appenders> | |
| # <Loggers> | |
| # <Root level="OFF"> | |
| # <AppenderRef ref="Null"/> | |
| # </Root> | |
| # </Loggers> | |
| #</Configuration> | |
| #EOF | |
| # Set Java options for memory management and custom logging | |
| ENV JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0 -Xmx12g -Dlog4j.configurationFile=file:/app/log4j2.xml" | |
| # Set Metabase specific environment variables | |
| ENV MB_DB_TYPE=postgres | |
| ENV MB_EMOJI_IN_LOGS=false | |
| ENV MB_COLORIZE_LOGS=false | |
| ENV MB_JETTY_PORT=7860 | |
| ENV MB_ENABLE_EMBEDDING=true | |
| ENV MB_EMBEDDING_APP_ORIGIN=* | |
| ENV MB_JWT_ENABLED=false | |
| ENV MB_PORT=7860 | |
| # Create directory for persistent data | |
| RUN mkdir -p /data | |
| # Create plugins directory | |
| RUN mkdir -p /app/plugins | |
| # Ensure correct permissions | |
| RUN chmod -R 777 /app/plugins | |
| # Expose the port Hugging Face Spaces expects | |
| EXPOSE 7860 | |
| # Ensure the data directory is a volume | |
| VOLUME /data | |
| # Add permissions for the data directory | |
| RUN chmod -R 777 /data | |
| # Start Metabase using the proper command | |
| ENTRYPOINT ["/app/run_metabase.sh"] | |