From e5b1b15dc3ad11c18de97e600fd5fb84ca69076b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Thu, 30 Sep 2021 11:13:44 +0200 Subject: [PATCH] Dockerfile: Optimize and consolidate steps (#9180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Moving up workdir will make mkdir call redundant * Consolidate into a single RUN instruction * Prefix etc/prometheus with a slash (it only worked because WORKDIR was / ) Signed-off-by: Manuel RĂ¼ger --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 838bf1834..b47f77dcd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,14 +14,13 @@ COPY LICENSE /LICENSE COPY NOTICE /NOTICE COPY npm_licenses.tar.bz2 /npm_licenses.tar.bz2 -RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ -RUN mkdir -p /prometheus && \ - chown -R nobody:nobody etc/prometheus /prometheus +WORKDIR /prometheus +RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ && \ + chown -R nobody:nobody /etc/prometheus /prometheus USER nobody EXPOSE 9090 VOLUME [ "/prometheus" ] -WORKDIR /prometheus ENTRYPOINT [ "/bin/prometheus" ] CMD [ "--config.file=/etc/prometheus/prometheus.yml", \ "--storage.tsdb.path=/prometheus", \