gdgr
gdgr

Reputation: 1435

How to deploy AngularJS app using nginx + docker to Elastic Beanstalk?

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.

Upvotes: 2

Views: 3249

Answers (2)

gdgr
gdgr

Reputation: 1435

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.

Upvotes: 2

Kapott
Kapott

Reputation: 11

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/

Upvotes: 1

Related Questions