I use azure devops pipeline to build jar and put it to docker image.
I use maven to build jar and put jar and dependencies to folder /componentA/target/container
Pom file - /componemtA/pom.xml
Docker file - /componentA/docker/Dockerfile
My pipeline yuml file is
...... stages: - stage: BUILD jobs: - job: BUILD_JAR_AND_IMAGE steps: - task: MavenAuthenticate@0 .... - task: Maven@3 ...... - task: Docker@2 inputs: command: login containerRegistry: xxxx - task: Docker@2 displayName: Build an image inputs: containerRegistry: 'xxx' repository: '$(image_name)' command: 'build' Dockerfile: '$(component_dir)/docker/Dockerfile' tags: '$(Build.BuildNumber)' My docker file is:
..... COPY /componentA/target/container /opt .... And I get error
2021-01-12T00:04:43.9376526Z Step 2/19 : COPY /componentA/target/container /opt
2021-01-12T00:04:43.9431565Z COPY failed: stat /var/lib/docker/tmp/docker-builder630817503/componentA/target/container: no such file or directory
2021-01-12T00:04:43.9501516Z ##[error]COPY failed: stat /var/lib/docker/tmp/docker-builder630817503/besReportService/target/container: no such file or directory
2021-01-12T00:04:43.9717162Z ##[error]The process '/usr/bin/docker' failed with exit code 1
copy command starts in var/lib/docker/tmp/docker-builder630817503 instead of /home/vsts/work/1/s
How to fix this problem ?