title: Node.js Dockerfile Build fails with "COPY failed: no source files were specified" using Azure Pipelines but works locally
body: <p>I am trying to push a docker image for a node.js application to the azure container registry. Even though the docker build works locally, it is failing on the docker build task using Azure Pipelines with this error:</p>
  <pre><code>Starting: Build container image
  ==============================================================================
  Task         : Bash
  Description  : Run a Bash script on macOS, Linux, or Windows
  Version      : 3.201.1
  Author       : Microsoft Corporation
  Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
  ==============================================================================
  Generating script.
  Script contents:
  docker build -f backend/Dockerfile acr_name.io/repo_name:latest /home/vsts/work/1/s
  ========================== Starting Command Output ===========================
  /usr/bin/bash /home/vsts/work/_temp/5a7f95db-4f1c-48b7-9a00-ef5a0d9fb6c6.sh
  Sending build context to Docker daemon  2.879MB
  
  Step 1/13 : FROM node:lts-bullseye
  lts-bullseye: Pulling from library/node
  ...
  Status: Downloaded newer image for node:lts-bullseye
   ---&gt; 9eeae0e42775
  Step 2/13 : WORKDIR /usr/src/app
   ---&gt; Running in 053af9da5ccc
  Removing intermediate container 053af9da5ccc
   ---&gt; 20a650e0839d
  Step 3/13 : COPY package*.json ./
  COPY failed: no source files were specified
  ##[error]Bash exited with code '1'.
  </code></pre>
  <p>This is my Dockerfile:</p>
  <pre><code>FROM node:lts-bullseye
  WORKDIR /usr/src/app
  COPY package*.json ./
  RUN npm install
  
  COPY . .
  RUN npm run build
  EXPOSE 8080
  CMD [ &quot;node&quot;, &quot;./dist/main.js&quot; ]
  </code></pre>
  <p>This is my pipeline:</p>
  <pre><code>parameters:
  - name: dockerFilePath
    type: string
  - name: acrName
    type: string
  - name: registryPath
    type: string
  - name: azureSubscription
    type: string
  - name: workingdirectory
    type: string
    default: $(Build.Repository.LocalPath)
  
  steps: 
  - task: AzureCLI@2
    displayName: Login to Azure Container Registry
    inputs:
      azureSubscription:  ${{ parameters.azureSubscription }}
      scriptType: 'bash'
      scriptLocation: 'inlineScript'
      inlineScript: 'az acr login -n ${{ parameters.acrName }}'
      displayName: Login to ACR
      
  - bash: |
      docker build -f ${{ parameters.dockerFilePath }} -t ${{ parameters.registryPath }}:latest ${{ parameters.workingdirectory }}
    displayName: Build container image
  </code></pre>
  <p>package-lock.json and package.json are in the same folder as the Dockerfile.</p>
  <p>Any suggestions?</p>