COPY No Source files were specified

6,583

The Dockerfile COPY command will copy files from the build "context" into your image. The build context the the folder you pass at the end of the build command. E.g. in docker build -t myimage:latest . command, the . is your context. To use the COPY command, the "dist/*" would need to exist in there.

Your RUN ls dist command is listing the directory inside the image you're building. If you want to copy files from one location inside your image to another location, you would do:

RUN cp -a dist/* /var/www/html/
Share:
6,583
Dafly45
Author by

Dafly45

merge delete

Updated on September 18, 2022

Comments

  • Dafly45
    Dafly45 almost 2 years

    Im trying to deploy a docker container to AWS CodeBuild and it keep failing on the following step:

    COPY dist/* /var/www/html/
    

    I'm sure there's something inside of that directory, and just to be sure I ran the command ls dist:

    Step 4 : RUN ls dist
    ---> Running in cc6a985f54dd
    1.1.329fd43c10e3d0fc91b9.js
    3.3.d0a0148e036318c95bfe.js
    4.4.d85fbfa6409009fb6e4c.js
    app.a6626f87bbfc6e67618d.js
    app.cd527cf8dea96798229c62fb7d983606.css
    favicon.ico
    humans.txt
    index.html
    robots.txt
    vendor.d81f28030613dd8760c0.js
    

    My dockerfile:

    FROM jaronoff/listmkr-prod
    # Remove the default nginx index.html
    RUN rm -rf /var/www/html/index.nginx-debian.html
    
    RUN npm run deploy:prod
    # Copy the contents of the dist directory over to the nginx web root
    
    RUN ls dist
    
    COPY dist/* /var/www/html/
    # Expose the public http port
    EXPOSE 80
    # Start server
    CMD ["nginx", "-g", "daemon off;"]