Reputation: 1345
I am using Github Actions to automate the process to push a docker image generated with the help of the maven plugin from Spring boot (mvn spring-boot:build-image), but I receive a maven error:
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.0.0:build-image failed: Error response received when pushing image: denied: requested access to the resource is denied
Using the following configuration:
- name: Build image & push
run: |
cd myFolder
mvn -X spring-boot:build-image \
--batch-mode --no-transfer-progress \
-Dspring-boot.build-image.publish=true \
-Dspring-boot.build-image.imageName="MY_USER/demo-ms:0.1.0" \
-DCI_REGISTRY=https://index.docker.io/v1 \
-DCI_REGISTRY_USER=${{ secrets.DOCKERHUB_USERNAME }} \
-DCI_REGISTRY_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }}
What I am missing?
Many thanks in advance
Juan Antonio
Upvotes: 1
Views: 899
Reputation: 1345
In github actions, it is possible to run a Script, so I found an alternative:
At github action level:
- name: Build image & push
run: |
cd myFolder
./build-spring-boot.sh ${{ secrets.DOCKERHUB_USERNAME }} ${{ secrets.DOCKERHUB_PASSWORD }}
At script level:
docker login "https://index.docker.io/v1/" -u="$1" -p="$2"
mvn spring-boot:build-image \
--batch-mode --no-transfer-progress
IMAGE_NAME=$(mvn help:evaluate -Dexpression=docker.image.name -q -DforceStdout)
echo $IMAGE_NAME
docker push $IMAGE_NAME
In this way, you can publish your image.
Upvotes: 0