Skip to content

Commit ea559ac

Browse files
committed
Move ownership change to COPY layer
Signed-off-by: Kaur Palang <kaur.palang@brightcodecompany.com>
1 parent da28677 commit ea559ac

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

dockerfiles/4.5.2-tp.1/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ COPY --chmod=755 entrypoint.sh /opt/engine/entrypoint.sh
2828

2929
RUN rm -rf cli-lib manager-lib \
3030
&& rm mirth-cli-launcher.jar oiecommand
31-
32-
RUN chown -R 1000:1000 /opt/engine
3331
FROM eclipse-temurin:17.0.15_6-jre-noble AS ubuntu-jre
3432

3533
ARG CREATED_AT
@@ -45,7 +43,7 @@ LABEL \
4543
"org.opencontainers.image.vendor"="The Open Integration Engine Project" \
4644
"org.opencontainers.image.version"="4.5.2-tp.1"
4745

48-
COPY --from=downloader /opt/engine /opt/engine
46+
COPY --from=downloader --chown=1000:1000 /opt/engine /opt/engine
4947

5048
RUN apt-get update \
5149
&& apt-get install -y unzip \
@@ -79,7 +77,7 @@ LABEL \
7977
"org.opencontainers.image.vendor"="The Open Integration Engine Project" \
8078
"org.opencontainers.image.version"="4.5.2-tp.1"
8179

82-
COPY --from=downloader /opt/engine /opt/engine
80+
COPY --from=downloader --chown=1000:1000 /opt/engine /opt/engine
8381

8482
RUN apt-get update \
8583
&& apt-get install -y unzip \
@@ -113,7 +111,7 @@ LABEL \
113111
"org.opencontainers.image.vendor"="The Open Integration Engine Project" \
114112
"org.opencontainers.image.version"="4.5.2-tp.1"
115113

116-
COPY --from=downloader /opt/engine /opt/engine
114+
COPY --from=downloader --chown=1000:1000 /opt/engine /opt/engine
117115

118116
RUN apk add --no-cache bash unzip \
119117
&& adduser -D -H -u 1000 engine engine
@@ -143,7 +141,7 @@ LABEL \
143141
"org.opencontainers.image.vendor"="The Open Integration Engine Project" \
144142
"org.opencontainers.image.version"="4.5.2-tp.1"
145143

146-
COPY --from=downloader /opt/engine /opt/engine
144+
COPY --from=downloader --chown=1000:1000 /opt/engine /opt/engine
147145

148146
RUN apk add --no-cache bash unzip \
149147
&& adduser -D -H -u 1000 engine engine

templates/Dockerfile.tpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ COPY --chmod=755 entrypoint.sh /opt/engine/entrypoint.sh
4444
RUN rm -rf cli-lib manager-lib \
4545
&& rm mirth-cli-launcher.jar oiecommand
4646

47-
RUN chown -R {{ $.config.uid }}:{{ $.config.gid }} /opt/engine
48-
4947
{{- /* Assign current version slug into a variable to carry it into the tags iteration */}}
5048
{{- $slug := dict "slug" .version.slug -}}
5149
{{/* Iterate version tags to generate the final stages */}}
@@ -58,7 +56,7 @@ LABEL \
5856
{{/* Render the Labels section to include the slug */}}
5957
{{- tpl $.config.labels $slug | strings.Indent 2 }}
6058

61-
COPY --from=downloader /opt/engine /opt/engine
59+
COPY --from=downloader --chown={{ $.config.uid }}:{{ $.config.gid }} /opt/engine /opt/engine
6260
{{ if eq .distro "ubuntu" }}
6361
RUN apt-get update \
6462
&& apt-get install -y unzip \

0 commit comments

Comments
 (0)