2

So I'm in the process of deploying an AngularJS app to an AWS Elastic Beanstalk instance.

I've successfully configured the build requirements, which involves uploading a Dockerrun.aws.json file that's configured to access an S3 storage bucket which in turn contains the .dockercfg file, used for accessing my private Docker repo.

Everything builds successfully, and nginx runs. I get the default "Welcome to nginx on Debian!" message.

So the only thing I'm having an issue with is now pointing the build of my AngularJS app to the active/home page (where the "Welcome.." screen appears.)

All of the app's contents are stored inside /build, from the root directory of the project, which is where my Dockerfile is contained.

From what I've gathered so far I think I need to go along the lines of:

FROM nginx
COPY /build/ /usr/share/nginx/html

Placed inside the Dockerfile, however those particular commands don't work.

I'm sure it's relatively trivial achieving what I'm hoping to, but having scoured various articles and documentations I can't find a simple answer. Any help much appreciated.

2 Answers 2

2

So I actually found the proper solution to this, in typical fashion, a few minutes after I'd written this question.

Kapott's answer is also along the right lines, however it's not quite there, so for good measure here's the answer:

COPY <directory_containing_app_index> /var/www/html/

The public html is stored inside the nginx directory /var/www/html/. I copied /usr/share/nginx/html/ from the nginx docker page, although I didn't expect that to be correct, it seemed from the explanation that was the way to do it.

Sign up to request clarification or add additional context in comments.

2 Comments

COPY will copy a directory as well, and should generally be preferred to ADD.
I did wonder that, I actually said that because of something I read, I didn't check COPY beforehand since it worked anyway with ADD, I'll amend my answer. Thanks!
1

You're almost there. Try omitting the first slash in the Dockerfile's copy command, so it takes the path relative to the Dockerfile:

COPY build /usr/share/nginx/html/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.