add Dockerfile for build and push on cite-maven

This commit is contained in:
Alexandros Mandilaras 2023-12-18 16:48:56 +02:00
parent f6d1538464
commit 6bd76b92f1
3 changed files with 64 additions and 1 deletions

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM maven:3.8.6-eclipse-temurin-17-focal
RUN apt-get update
RUN apt-get install gpg -y
ARG MAVEN_ACCOUNT_USR
ARG MAVEN_ACCOUNT_PSW
ARG REVISION
ARG MAVEN_GPG_PASSPHRASE
ARG MAVEN_GPG_KEYNAME
ARG PROFILE
ENV gpg_keyname=$MAVEN_GPG_KEYNAME
ENV gpg_passphrase=$MAVEN_GPG_PASSPHRASE
ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
COPY settings.xml /root/.m2/settings.xml
COPY keypair.asc /tmp/keypair.asc
RUN if [ "$PROFILE" = "ossrh" ]; then \
gpg --batch --import /tmp/keypair.asc; \
fi
WORKDIR /build/
COPY . .
RUN mvn -Drevision=${REVISION} -P${PROFILE} clean deploy

20
pom.xml
View File

@ -56,8 +56,26 @@
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.12.0</version> <version>3.12.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>dev</id>
<name>Dev Profile</name>
<url>${devProfileUrl}</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>dev</id>
<name>Dev Profile</name>
<url>${devProfileUrlDeposit}</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project> </project>

18
settings.xml Normal file
View File

@ -0,0 +1,18 @@
<settings>
<servers>
<server>
<id>ossrh</id>
<username>${server_username}</username>
<password>${server_password}</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<properties>
<gpg.passphrase>${gpg_passphrase}</gpg.passphrase>
<gpg.keyname>${gpg_keyname}</gpg.keyname>
</properties>
</profile>
</profiles>
</settings>