papri-ka commited on
Commit
03995dc
·
verified ·
1 Parent(s): aeb0217

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -1,18 +1,23 @@
1
  FROM prom/prometheus:latest
2
 
 
 
 
3
  WORKDIR /app
4
 
5
  # Copy your config
6
  COPY turing_cloud.yml /app/turing_cloud.yml
7
 
8
- # Switch to root to ensure permissions (optional but often safer on Spaces)
9
- USER root
10
-
11
- # 1. OVERRIDE the default Entrypoint.
12
- # This tells Docker: "Don't run Prometheus yet. Run a shell instead."
13
- ENTRYPOINT ["/bin/sh", "-c"]
14
 
15
- # 2. Run the command as a single string.
16
- # The shell will now expand $PORT correctly before starting Prometheus.
17
- # We strictly bind to 0.0.0.0 to fix your Timeout issue.
18
- CMD ["/bin/prometheus --config.file=/app/turing_cloud.yml --web.listen-address=0.0.0.0:$PORT --web.external-url=http://r-turing-team-turing-promethetus-server-kvuknls8-5a966-827mr.hf.space --storage.tsdb.path=/prometheus --web.enable-lifecycle"]
 
 
 
 
 
 
 
1
  FROM prom/prometheus:latest
2
 
3
+ # 1. Switch to root to allow file editing
4
+ USER root
5
+
6
  WORKDIR /app
7
 
8
  # Copy your config
9
  COPY turing_cloud.yml /app/turing_cloud.yml
10
 
11
+ # 2. Reset Entrypoint so we can use a custom shell command
12
+ ENTRYPOINT []
 
 
 
 
13
 
14
+ # 3. Dynamic Startup Command
15
+ # A. Use 'sed' to replace "localhost:7860" with "localhost:$PORT" in your config.
16
+ # B. Start Prometheus binding to 0.0.0.0:$PORT
17
+ CMD sh -c "sed -i \"s/localhost:7860/localhost:$PORT/g\" /app/turing_cloud.yml && \
18
+ /bin/prometheus \
19
+ --config.file=/app/turing_cloud.yml \
20
+ --web.listen-address=0.0.0.0:$PORT \
21
+ --web.external-url=http://r-turing-team-turing-promethetus-server-kvuknls8-5a966-827mr.hf.space \
22
+ --storage.tsdb.path=/prometheus \
23
+ --web.enable-lifecycle"