Paketo builds with Maven settings.xml volume mount

I’m trying to modify the Auto Devops build using the Paketo builder to mount a volume with my Maven settings.xml to pull from a private GitLab Maven package registry. After reading the documentation Limitations of Docker in Docker on mounting volumes I thought I’d be able to fix my issue but unfortunately I’m still unable to pull from the package registry. I’ve tested out my settings.xml and pom.xml locally by mounting the bindings and everything works as expected. Everything appears to point to an issue with the volume not being mounted. Has anyone tried using volumes with Pack and the Paketo build in their pipeline?

Here’s my build stage which is copied from auto-build-image’s build.sh. The only modifications are the first 3 lines to copy over my Paketo bindings to the mount point and the addition of the volume in the pack build.

build:
  stage: build
  variables:
    MOUNT_PATH: /builds/$CI_PROJECT_PATH/mnt
    BP_JVM_VERSION: 8
    BP_MAVEN_BUILT_MODULE: engine
    BP_MAVEN_BUILD_ARGUMENTS: -DskipTests package
    AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES: PACKAGE_REGISTRY_TOKEN,BP_JVM_VERSION,BP_MAVEN_BUILT_MODULE,BP_MAVEN_BUILD_ARGUMENTS
  script:
    - mkdir -p "${MOUNT_PATH}"
    - cp -r bindings "${MOUNT_PATH}"
    - export MAVEN_BINDING_PATH="${MOUNT_PATH}/bindings/java/maven-settings"
    - |
      # This script is copied from auto-build-image's build.sh. The only modification is adding a volume to pack build
      if ! docker info &>/dev/null; then
        if [ -z "$DOCKER_HOST" ] && [ "$KUBERNETES_PORT" ]; then
          export DOCKER_HOST='tcp://localhost:2375'
        fi
      fi

      if [[ -n "$CI_REGISTRY" && -n "$CI_REGISTRY_USER" ]]; then
        echo "Logging in to GitLab Container Registry with CI credentials..."
        echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
      fi

      image_previous="$CI_APPLICATION_REPOSITORY:$CI_COMMIT_BEFORE_SHA"
      image_tagged="$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG"
      image_latest="$CI_APPLICATION_REPOSITORY:latest"

      builder=${AUTO_DEVOPS_BUILD_IMAGE_CNB_BUILDER:-"heroku/buildpacks:18"}
      echo "Building Cloud Native Buildpack-based application with builder ${builder}..."
      buildpack_args=()
      if [[ -n "$BUILDPACK_URL" ]]; then
        buildpack_args=('--buildpack' "$BUILDPACK_URL")
      fi
      env_args=()
      if [[ -n "$AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES" ]]; then
        mapfile -t env_arg_names < <(echo "$AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES" | tr ',' "\n")
        for env_arg_name in "${env_arg_names[@]}"; do
          env_args+=('--env' "$env_arg_name")
        done
      fi
      pack build tmp-cnb-image \
        --volume "${MAVEN_BINDING_PATH}:/platform/bindings/maven-settings" \
        --builder "$builder" \
        "${env_args[@]}" \
        "${buildpack_args[@]}" \
        --env HTTP_PROXY \
        --env http_proxy \
        --env HTTPS_PROXY \
        --env https_proxy \
        --env FTP_PROXY \
        --env ftp_proxy \
        --env NO_PROXY \
        --env no_proxy

      cp /build/cnb.Dockerfile Dockerfile

      docker build \
        --build-arg source_image=tmp-cnb-image \
        --tag "$image_tagged" \
        --tag "$image_latest" \
        .

      docker push "$image_tagged"
      docker push "$image_latest"
      exit 0

The settings XML uses an environment variable but I’ve also tried hard coding the deploy token but that also fails to pull the dependencies. Below are the files I have to configure the Paketo bindings according to the Paketo Configuration documentation.

# bindings/java/maven-settings/settings.xml
<settings>
    <servers>
        <server>
            <id>gitlab-maven</id>
            <configuration>
                <httpHeaders>
                    <property>
                        <name>Deploy-Token</name>
                        <value>${env.PACKAGE_REGISTRY_TOKEN}</value>
                    </property>
                </httpHeaders>
            </configuration>
        </server>
    </servers>
</settings>

I also have a type file with the contents maven to configure the Paketo bindings.

# bindings/java/maven-settings/type
maven