Docker File:

ARTIFACTORY: Maven build and containerising it with Docker build using Gitlab and integration with Artifactory and scan with JFrog Xray as part of a JFrog Project

AuthorFullName__c
Swarnendu Kayal
articleNumber
000005370
ft:sourceType
Salesforce
FirstPublishedDate
2022-08-14T06:50:06Z
lastModifiedDate
2025-05-15
VersionNumber
5

For a docker build, we need to have a docker file created. The docker file contents is as below - 

FROM maven:latest
RUN mkdir -p /usr/local/maven && mkdir -p /root/.m2 && mkdir /root/.m2/repository
# Copy maven settings, containing repository configurations
COPY settings.xml /root/.m2
WORKDIR /usr/local/maven
ADD ./maven-example .
RUN mvn clean install
RUN mvn clean deploy


The docker file is actually performing the below items - 

  1. Pull a maven image
  2. Create directories as “/usr/local/maven” and “/root/.m2” and “/root/.m2/repository”
  3. Copy the “settings.xml” to the “/root/.m2” directory.
  4. Declare “/usr/local/maven” as the working directory.
  5. Copy the entire “maven-example” folder along with its content from the GitLab repository to the defined working directory.
  6. Run the command “mvn clean install”
  7. Run the command “mvn clean deploy”