user3465651
user3465651

Reputation: 764

Unable to publish docker image with spring boot maven plugin

I've been struggling with this all day. Setup:

Using: mvn clean spring-boot:build-image builds the image but when trying to push to github container registry I receive the following:

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.4.2:build-image-no-fork failed: Error response received when pushing image: unsupported

The configuration for the plugin in pom.xml is as follows:

<profiles>
  <profile>
    <id>oci</id>
    <build>
      <plugins>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <configuration>
            <docker>
              <publishRegistry>
                <token>${env.TOKEN}</token>
              </publishRegistry>
            </docker>
            <image>
              <verboseLogging>true</verboseLogging>
              <env>
                <BP_JVM_VERSION>${java.version}</BP_JVM_VERSION>
              </env>
              <name>ghcr.io/av-software/${artifactId}:${version}</name>
              <publish>true</publish>
            </image>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>build-image-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
  </profile>
<profiles>

github actions look like:

name: Develoment build pipeline
on:
  push:
    branches:
      - '**'
      - '!master'
env:
  REGISTRY: ghcr.io
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
      attestations: write
      id-token: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          java-version: '23'
          distribution: 'liberica'
          cache: 'maven'
      - name: Log in to the Container registry
        uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - run: mvn clean package -Poci -DskipTests
        env:
          TOKEN: ${{ secrets.PUBLISH_TOKEN }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}

The token has everything thrown at it(yes bad, but I've been stuck with this for a while)

I am able to manually push the container image, so I am perplexed as to what the issue us. Using the -X it looks like it's retrying until the retrys are exceeded then fails when pushing.

Any help will be greatly appreciated

Upvotes: 0

Views: 46

Answers (0)

Related Questions