Update Dockerfile
Browse files- Dockerfile +9 -10
Dockerfile
CHANGED
|
@@ -1,24 +1,23 @@
|
|
| 1 |
FROM prom/prometheus:latest
|
| 2 |
|
| 3 |
-
# 1. Run as root
|
| 4 |
USER root
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
# 2. Copy
|
| 9 |
COPY turing_cloud.yml /app/turing_cloud.yml
|
| 10 |
|
| 11 |
-
# 3.
|
| 12 |
-
# This allows us to run complex commands and expand variables like $PORT.
|
| 13 |
ENTRYPOINT ["/bin/sh", "-c"]
|
| 14 |
|
| 15 |
-
# 4.
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
sed -i \"s/localhost:7860/localhost:$
|
| 20 |
/bin/prometheus \
|
| 21 |
--config.file=/app/turing_cloud.yml \
|
| 22 |
-
--web.listen-address=0.0.0.0:$
|
| 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"]
|