Mvn Command Not Running from Dockerfile

Hello,

not sure why using multistage when you have maven, jdk and alpine available in below simple Dockerfile

# AS <NAME> to name this stage as maven
FROM scratch
LABEL MAINTAINER="Sam"
FROM maven:3.8.6-eclipse-temurin-11-alpine AS maven
RUN apk update && apk add git && apk add net-tools procps openssh-client openssh-server
RUN mkdir -p $HOME/images/lib/ && cd $HOME/images/lib/
#RUN git clone MY_GIT_URL
RUN mvn --version
RUN mvn clean install -e

if you have specific requirement for ubuntu and eclipse-temurin image you have to make the docker file properly with below command in Dockerfile

COPY --from=<previous-stage-name> <source> <destination>

Hope this helps.

1 Like