FROM prom/prometheus:latest USER root WORKDIR /app # Copy the config with the placeholder COPY turing_cloud.yml /app/turing_cloud.yml # Reset entrypoint ENTRYPOINT ["/bin/sh", "-c"] # Startup Command: # 1. Export PORT (fallback to 7860) # 2. Inject the PORT into the config # 3. Inject the PASSWORD into the config (using | as delimiter to avoid issues with special chars) # 4. Start Prometheus CMD ["export RUN_PORT=${PORT:-7860} && \ echo 'System starting on PORT: '$RUN_PORT && \ sed -i \"s/localhost:7860/localhost:$RUN_PORT/g\" /app/turing_cloud.yml && \ sed -i \"s|GRAFANA_PASSWORD|$GRAFANA_PASSWORD|g\" /app/turing_cloud.yml && \ /bin/prometheus \ --config.file=/app/turing_cloud.yml \ --web.listen-address=0.0.0.0:$RUN_PORT \ --storage.tsdb.path=/prometheus \ --web.enable-lifecycle"]