kadarakos commited on
Commit
012845b
·
1 Parent(s): da6f4cc

Reset entrypoint to allow shell script execution

Browse files
Files changed (1) hide show
  1. 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
- # Create the directory and ensure the prometheus user (built-in) owns it
 
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
- # Switch back to the prometheus user (ID 65534 is standard for this image)
 
 
 
15
  USER 65534
16
 
17
- # Use 'sed' to replace the variable. It's pre-installed on almost every Linux.
18
- # This avoids needing to install 'gettext' via apk.
19
  CMD ["/bin/sh", "-c", "\
20
- sed \"s/\${HF_TOKEN}/$HF_TOKEN/g\" /etc/prometheus/prometheus.yml.template > /etc/prometheus/prometheus.yml && \
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"]