Spotify maven deploy on gitlab

76 Views Asked by At

I've implemented in my pom.xml dockerfile-maven-plugin as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.garanteasy.keycloak</groupId>
  <artifactId>keycloak-auth-server</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>
...
  <build>
    <finalName>${project.groupId}-${project.artifactId}</finalName>
    <plugins>
...
      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>dockerfile-maven-plugin</artifactId>
        <version>${dockerfile-maven-version}</version>
        <configuration>
          <repository>registry.gitlab.com/garanteasy/${project.artifactId}</repository>
          <tag>${project.version}</tag>
          <buildArgs>
            <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
            <keycloak_version>${keycloak_runtime.version}</keycloak_version>
          </buildArgs>
        </configuration>
        <executions>
          <execution>
            <id>default</id>
            <goals>
              <goal>build</goal>
              <goal>push</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

but mvn deploy fails with error

[INFO] --- dockerfile-maven-plugin:1.4.13:push (default) @ keycloak-auth-server ---
[INFO] The push refers to repository [registry.gitlab.com/garanteasy/keycloak-auth-server]
[INFO] Image c83dc53979b0: Preparing
[INFO] Image 21f516d00efd: Preparing
[INFO] Image f51bb4d0f202: Preparing
[INFO] Image 8eca1024ce55: Preparing
[INFO] Image e54dc53d0edb: Preparing
[ERROR] denied: access forbidden

if I simply execute

mvn package
docker push registry.gitlab.com/garanteasy/keycloak-auth-server:1.0

everything runs smooth.

Spotify's documentations states that the credentials are read from ~/.docker/config.json as the docker command does, so what's wrong with my maven configuration? or is there another maven plugin you can suggest me?

0

There are 0 best solutions below