Set Dockerfile path as the same directory

Viewed 137

My dockerfile and source code are in the same directory, so my cloudbuild.yaml file has '.' as the argument. enter image description here

However, I am getting this error: enter image description here

I already specified path '.', but its looking for a different path /workspace/Dockerfile.

My cloudbuil.yaml file:

steps:
  - name: gcr.io/cloud-builders/docker
    args:
      - build
      - '-t'
      - gcr.io/$PROJECT_ID/$_API_NAME
      - .
    id: docker_build
  - name: gcr.io/cloud-builders/docker
    args:
      - push
      - gcr.io/$PROJECT_ID/$_API_NAME
    id: docker_push
1 Answers

Can you please try adding the build and dot arguments in a single quote format as below?

- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '-t'
  - 'gcr.io/$PROJECT_ID/$_API_NAME'
  - '.'

Also, you could add a ls command prior to docker build for troubleshooting purposes, just to make sure you have the Dockerfile and source at the current directory.

Related