Spaces:
Sleeping
Sleeping
Reset entrypoint to allow shell script execution
Browse files- Dockerfile +8 -10
Dockerfile
CHANGED
|
@@ -1,23 +1,21 @@
|
|
| 1 |
FROM prom/prometheus:v2.45.0
|
| 2 |
-
|
| 3 |
-
# In the official Prometheus image, 'envsubst' is usually NOT installed,
|
| 4 |
-
# but 'sh' is. We will use a simple 'sed' command instead of 'envsubst'
|
| 5 |
-
# to avoid needing 'apk' or 'root' access.
|
| 6 |
-
|
| 7 |
USER root
|
| 8 |
-
|
|
|
|
| 9 |
RUN mkdir -p /prometheus && chown -R 65534:65534 /prometheus
|
| 10 |
|
| 11 |
# Copy the template
|
| 12 |
COPY prometheus.yml.template /etc/prometheus/prometheus.yml.template
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
| 15 |
USER 65534
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
# This avoids needing to install 'gettext' via apk.
|
| 19 |
CMD ["/bin/sh", "-c", "\
|
| 20 |
-
sed \"s
|
| 21 |
/bin/prometheus --config.file=/etc/prometheus/prometheus.yml \
|
| 22 |
--storage.tsdb.path=/prometheus \
|
| 23 |
--web.listen-address=:7860"]
|
|
|
|
| 1 |
FROM prom/prometheus:v2.45.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
USER root
|
| 3 |
+
|
| 4 |
+
# Create directory with correct permissions for the prometheus user (65534)
|
| 5 |
RUN mkdir -p /prometheus && chown -R 65534:65534 /prometheus
|
| 6 |
|
| 7 |
# Copy the template
|
| 8 |
COPY prometheus.yml.template /etc/prometheus/prometheus.yml.template
|
| 9 |
|
| 10 |
+
# Reset the entrypoint so we can run a shell script
|
| 11 |
+
ENTRYPOINT []
|
| 12 |
+
|
| 13 |
+
# Switch to the prometheus user
|
| 14 |
USER 65534
|
| 15 |
|
| 16 |
+
# Now we can safely run /bin/sh to process our template with sed
|
|
|
|
| 17 |
CMD ["/bin/sh", "-c", "\
|
| 18 |
+
sed \"s|\\${HF_TOKEN}|$HF_TOKEN|g\" /etc/prometheus/prometheus.yml.template > /etc/prometheus/prometheus.yml && \
|
| 19 |
/bin/prometheus --config.file=/etc/prometheus/prometheus.yml \
|
| 20 |
--storage.tsdb.path=/prometheus \
|
| 21 |
--web.listen-address=:7860"]
|