papri-ka commited on
Commit
7313eba
·
verified ·
1 Parent(s): cd0138c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -10
Dockerfile CHANGED
@@ -1,24 +1,23 @@
1
  FROM prom/prometheus:latest
2
 
3
- # 1. Run as root to avoid any permission issues
4
  USER root
5
 
6
  WORKDIR /app
7
 
8
- # 2. Copy your configuration
9
  COPY turing_cloud.yml /app/turing_cloud.yml
10
 
11
- # 3. CRITICAL: Force the entrypoint to be a shell.
12
- # This allows us to run complex commands and expand variables like $PORT.
13
  ENTRYPOINT ["/bin/sh", "-c"]
14
 
15
- # 4. The Startup Command
16
- # We use 'sed' to update the config file with the correct port dynamically.
17
- # Then we start Prometheus, forcing it to listen on 0.0.0.0 (IPv4).
18
- CMD ["echo 'System starting on PORT: '$PORT && \
19
- sed -i \"s/localhost:7860/localhost:$PORT/g\" /app/turing_cloud.yml && \
20
  /bin/prometheus \
21
  --config.file=/app/turing_cloud.yml \
22
- --web.listen-address=0.0.0.0:$PORT \
23
  --storage.tsdb.path=/prometheus \
24
  --web.enable-lifecycle"]
 
1
  FROM prom/prometheus:latest
2
 
3
+ # 1. Run as root
4
  USER root
5
 
6
  WORKDIR /app
7
 
8
+ # 2. Copy config
9
  COPY turing_cloud.yml /app/turing_cloud.yml
10
 
11
+ # 3. Reset Entrypoint
 
12
  ENTRYPOINT ["/bin/sh", "-c"]
13
 
14
+ # 4. Startup Command with Fallback
15
+ # ${PORT:-7860} means: "Use $PORT if it exists; otherwise use 7860".
16
+ CMD ["export RUN_PORT=${PORT:-7860} && \
17
+ echo 'System starting on PORT: '$RUN_PORT && \
18
+ sed -i \"s/localhost:7860/localhost:$RUN_PORT/g\" /app/turing_cloud.yml && \
19
  /bin/prometheus \
20
  --config.file=/app/turing_cloud.yml \
21
+ --web.listen-address=0.0.0.0:$RUN_PORT \
22
  --storage.tsdb.path=/prometheus \
23
  --web.enable-lifecycle"]