I am using the sh file which contains all the maven configuration, secret keys, maven command and all, I I want to execute this sh file from inside the Dockerfile so that when I run the container sh file will execute.
this is how my Docker file looks like:
#using alpine jdk
FROM somewhere.docker.hub/build/alpine:latest AS fetch
#MVN as build tool
FROM somewhere.docker.hub/build/maven:3.5.3-jdk-8 AS build
#Settings.xml for downloading dependencies from nexus repository
ARG MVN_SETTINGS=settings.xml
#Defining the current working repository
WORKDIR /usr/src/app
#Coping the pom.xml into working directory
COPY pom.xml /usr/src/app
COPY ${MVN_SETTINGS} /usr/src/app/settings.xml
# Download the package and make it cached in docker image
#RUN mvn -B -f ./pom.xml -s settings.xml dependency:resolve
#Coping the source code into the working repository
COPY . /usr/src/app
#Run the sh file
#RUN chmod a+x /usr/src/app/DockerTest.sh
# Not using the full path of DockerTest.sh file because it is already in the work directory as defined above
RUN chmod a+x DockerTest.sh
DockerTest.sh file looks like this.
#!/bin/sh
mvn clean install
mvn test
when I create the docker image and run the image, it shows this error. I have tried lots of things it is still not working, it shows this error
No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]