Create config at runtime
This commit is contained in:
parent
0956729298
commit
7f6c6a1e57
2 changed files with 12 additions and 12 deletions
16
Dockerfile
16
Dockerfile
|
@ -1,16 +1,12 @@
|
|||
FROM cloudron/base:2.0.0@sha256:f9fea80513aa7c92fe2e7bf3978b54c8ac5222f47a9a32a7f8833edf0eb5a4f4
|
||||
|
||||
# install Prometheus
|
||||
RUN mkdir -p /usr/local/bin/prometheus && \
|
||||
cd /usr/local/bin && \
|
||||
wget -c https://github.com/prometheus/prometheus/releases/download/v2.22.0/prometheus-2.22.0.linux-amd64.tar.gz && \
|
||||
tar xvfz prometheus-*.tar.gz && \
|
||||
rm -rf prometheus-*.tar.gz && \
|
||||
mv prometheus-*/* prometheus && \
|
||||
rm -rf prometheus-* && \
|
||||
chown -R cloudron:cloudron prometheus
|
||||
RUN mkdir -p /app/code
|
||||
WORKDIR /app/code
|
||||
|
||||
RUN sudo -u cloudron cp -n /usr/local/bin/prometheus/prometheus.yml /app/data/config/prometheus.yml
|
||||
ARG VERSION=2.22.0
|
||||
|
||||
# install Prometheus
|
||||
RUN curl -L https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.linux-amd64.tar.gz | tar zxvf - --strip-components 1
|
||||
|
||||
COPY start.sh /app/pkg/
|
||||
|
||||
|
|
8
start.sh
8
start.sh
|
@ -4,8 +4,12 @@ set -eu
|
|||
|
||||
mkdir -p /app/data/runtime /app/data/config
|
||||
|
||||
if [[ ! -f /app/data/config/prometheus.yml ]]; then
|
||||
echo "=> Creating config file on first run"
|
||||
sudo -u cloudron cp -n /usr/local/bin/prometheus/prometheus.yml /app/data/config/prometheus.yml
|
||||
fi
|
||||
|
||||
chown -R cloudron:cloudron /app/data
|
||||
|
||||
echo "=> Starting Prometheus"
|
||||
cd /usr/local/bin/prometheus
|
||||
exec /usr/local/bin/gosu cloudron:cloudron ./prometheus --config.file=/app/data/config/prometheus.yml --storage.tsdb.path=/app/data/runtime
|
||||
exec /usr/local/bin/gosu cloudron:cloudron /app/code/prometheus --config.file=/app/data/config/prometheus.yml --storage.tsdb.path=/app/data/runtime
|
||||
|
|
Loading…
Reference in a new issue