3

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;"]
2
  • Does /var/www/html/ exist? What error message are you getting?
    – jordanm
    Oct 11, 2017 at 15:46
  • I’m getting the “No source files were specified” message
    – jaronoff97
    Oct 11, 2017 at 15:50

1 Answer 1

3

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/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .