Skip to content
Snippets Groups Projects
Commit f489e738 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

use maven profiles for image building

parent 8e87bc72
Branches
Tags
No related merge requests found
...@@ -65,14 +65,15 @@ push_docker_image: ...@@ -65,14 +65,15 @@ push_docker_image:
command: ["--tls=false"] command: ["--tls=false"]
script: script:
- FAILED_STAGE=$CI_JOB_STAGE - FAILED_STAGE=$CI_JOB_STAGE
- IMAGE_TAGS="$DOCKER_REGISTRY_IMAGE:$(./gitlab/get_tag_version.sh)" - export IMAGE_TAG=$(./gitlab/get_tag_version.sh)
- | - |
if [[ "$CI_COMMIT_REF_NAME" == "main" ]]; then if [[ "$CI_COMMIT_REF_NAME" == "main" ]]; then
IMAGE_TAGS="$IMAGE_TAGS,$DOCKER_REGISTRY_IMAGE:snapshot-latest" run_mvn.sh spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -P main -Ddocker.publishRegistry.username=${NEXUS_USER} -Ddocker.publishRegistry.password=${NEXUS_PASSWORD}
elif [[ "$CI_COMMIT_REF_NAME" == "release" ]]; then elif [[ "$CI_COMMIT_REF_NAME" == "release" ]]; then
IMAGE_TAGS="$IMAGE_TAGS,$DOCKER_REGISTRY_IMAGE:latest" run_mvn.sh spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -P release -Ddocker.publishRegistry.username=${NEXUS_USER} -Ddocker.publishRegistry.password=${NEXUS_PASSWORD}
else
run_mvn.sh spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -P dev -Ddocker.publishRegistry.username=${NEXUS_USER} -Ddocker.publishRegistry.password=${NEXUS_PASSWORD}
fi fi
- run_mvn.sh spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -Dspring-boot.build-image.publish=true -Ddocker.publishRegistry.username=${NEXUS_USER} -Ddocker.publishRegistry.password=${NEXUS_PASSWORD} -Dspring-boot.build-image.tags=${IMAGE_TAGS}
test_build_deploy_helm_chart: test_build_deploy_helm_chart:
stage: publish stage: publish
......
...@@ -134,4 +134,59 @@ ...@@ -134,4 +134,59 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>$DOCKER_REGISTRY_IMAGE/$IMAGE_TAG</name>
<publish>true</publish>
</image>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>main</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>$DOCKER_REGISTRY_IMAGE/$IMAGE_TAG</name>
<tags>$DOCKER_REGISTRY_IMAGE:snapshot-latest</tags>
<publish>true</publish>
</image>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>$DOCKER_REGISTRY_IMAGE/$IMAGE_TAG</name>
<tags>$DOCKER_REGISTRY_IMAGE:snapshot-latest</tags>
<publish>true</publish>
</image>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment