Skip to content

Commit 41ec6ba

Browse files
committed
Consolidate COPY operations into a single layer
1 parent c1816e1 commit 41ec6ba

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

maven/Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@
22
# This cannot be inlined below (e.g., COPY --from=maven:...) because Dependabot does not support that syntax yet
33
FROM maven:3.9.9 as maven
44

5+
FROM ghcr.io/dependabot/dependabot-updater-core AS builder
6+
7+
COPY --chown=dependabot:dependabot --from=maven /usr/share/maven $DEPENDABOT_HOME/maven-installation
8+
COPY --chown=dependabot:dependabot --parents maven common $DEPENDABOT_HOME/
9+
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater
10+
511
FROM ghcr.io/dependabot/dependabot-updater-core
612

713
RUN apt-get update && apt-get install -y --no-install-recommends \
814
openjdk-21-jdk-headless \
915
ca-certificates-java \
1016
&& rm -rf /var/lib/apt/lists/*
1117

12-
COPY --from=maven /usr/share/maven /usr/share/maven
18+
USER dependabot
1319

14-
ENV MAVEN_HOME=/usr/share/maven
20+
COPY --from=builder $DEPENDABOT_HOME $DEPENDABOT_HOME
1521

16-
RUN ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn
22+
ENV MAVEN_HOME=$DEPENDABOT_HOME/maven-installation
1723

18-
USER dependabot
24+
ENV PATH="${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${PATH}"
1925

20-
ENV PATH=$JAVA_HOME/bin:$PATH
2126
ENV MAVEN_ARGS="-Dmaven.repo.local=$DEPENDABOT_HOME/.m2"
2227

23-
COPY --chown=dependabot:dependabot --parents maven common $DEPENDABOT_HOME/
24-
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater
25-
2628
# symlink so script/dependabot just works
2729
RUN mkdir -p ~/.m2 && ln -s ~/maven/settings.xml ~/.m2/settings.xml

0 commit comments

Comments
 (0)