File size: 726 Bytes
e57873f
da6f4cc
012845b
 
da6f4cc
e57873f
da6f4cc
e57873f
 
012845b
 
 
 
da6f4cc
 
012845b
e57873f
012845b
e57873f
 
 
da6f4cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM prom/prometheus:v2.45.0
USER root

# Create directory with correct permissions for the prometheus user (65534)
RUN mkdir -p /prometheus && chown -R 65534:65534 /prometheus

# Copy the template
COPY prometheus.yml.template /etc/prometheus/prometheus.yml.template

# Reset the entrypoint so we can run a shell script
ENTRYPOINT []

# Switch to the prometheus user
USER 65534

# Now we can safely run /bin/sh to process our template with sed
CMD ["/bin/sh", "-c", "\
    sed \"s|\\${HF_TOKEN}|$HF_TOKEN|g\" /etc/prometheus/prometheus.yml.template > /etc/prometheus/prometheus.yml && \
    /bin/prometheus --config.file=/etc/prometheus/prometheus.yml \
    --storage.tsdb.path=/prometheus \
    --web.listen-address=:7860"]