0

I'm trying to setup a concourse pipeline that builds an image and pushes it to a quay registry. However, it keeps failing with:

Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile

This is the pipeline file:

resources:
- name: source-code
  type: git
  source:
    uri: gitlab.git
    branch: main
    username: ((gitlab-auth.username))
    password: ((gitlab-auth.password))

- name: kaniko-image
  type: registry-image
  source:
    repository: gcr.io/kaniko-project/executor
    tag: debug

- name: push-image
  type: registry-image
  source:
    repository: quay.io/gitlab
    username: ((quay-gitlab-mr.username))
    password: ((quay-gitlab-mr.password))

jobs:
- name: build-and-push-image
  plan:
  - get: source-code
    trigger: true
  - get: kaniko-image
  - task: build-task-image
    config:
      platform: linux
      image_resource:
        type: registry-image
        source:
          repository: quay.io
          tag: kaniko-v1
      inputs:
      - name: source-code
      params:
        CONTEXT: source-code
        DOCKERFILE: Dockerfile
        IMAGE_NAME: quay.io/gitlab
        TAG: 1.0.5
      run:
        path: /kaniko/executor
        args:
        - --context=${CONTEXT}
        - --destination=${IMAGE_NAME}:${TAG}
        - --dockerfile=${DOCKERFILE}
        - --force
  - put: push-image
    params:
      image: source-code/image.tar

My understanding is that when concourse pulls the source code down into the worker, it does so in a directory called source-code so thats where the Dockerfile should be as it is in the root of my directory. I have tried using workspace, variations of directory structures and specifying the tmp dir where the concourse logs show it is cloning to. But all result in the same error

When I don't use Kaniko and just do a normal build in a privileged task, I can build the image fine and push. But it fails with Kaniko and I cannot run privileged in my use case.

Any ideas what is wrong?

Lucky7865
  • 77
  • 1
  • 9

0 Answers0