Skip to content

Commit e5b1b15

Browse files
authored
Dockerfile: Optimize and consolidate steps (#9180)
* 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]>
1 parent a05b510 commit e5b1b15

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ COPY LICENSE /LICENSE
1414
COPY NOTICE /NOTICE
1515
COPY npm_licenses.tar.bz2 /npm_licenses.tar.bz2
1616

17-
RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/
18-
RUN mkdir -p /prometheus && \
19-
chown -R nobody:nobody etc/prometheus /prometheus
17+
WORKDIR /prometheus
18+
RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ && \
19+
chown -R nobody:nobody /etc/prometheus /prometheus
2020

2121
USER nobody
2222
EXPOSE 9090
2323
VOLUME [ "/prometheus" ]
24-
WORKDIR /prometheus
2524
ENTRYPOINT [ "/bin/prometheus" ]
2625
CMD [ "--config.file=/etc/prometheus/prometheus.yml", \
2726
"--storage.tsdb.path=/prometheus", \

0 commit comments

Comments
 (0)