Update Dockerfile
Browse files- 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 |
-
#
|
| 9 |
-
|
| 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 |
-
#
|
| 16 |
-
#
|
| 17 |
-
#
|
| 18 |
-
CMD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"
|