Skip to content

Commit

Permalink
Dockerfile: Optimize and consolidate steps (prometheus#9180)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
mrueg authored Sep 30, 2021
1 parent a05b510 commit e5b1b15
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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", \
Expand Down

0 comments on commit e5b1b15

Please sign in to comment.