Neil Young
Neil Young

Reputation: 556

Docker & Amazon Beanstalk - Deploy an Angular application

I am trying to deploy a dist folder that is generated with versioning by Gulp using a Dockerfile and with Amazon EB.

This fails when I run eb deploy with:

COPY dist /var/www/html dist: no such file or directory. Check snapshot logs for details. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

Is this because the dist directory is not under source control? If so, what is the best way to transfer the dist directory up to EB whilst still using my docker file to deploy and configure the application?

Below is my Dockerfile:

FROM nimmis/apache-php5

COPY dist /var/www/html
WORKDIR /var/www/html

EXPOSE 80 

Upvotes: 0

Views: 426

Answers (2)

Neil Young
Neil Young

Reputation: 556

I think my understanding of eb deploy was the issue. Answer is to zip the dist directory, along with other files using a bash script and create my own artifact for the config.yml file:

e.g.

dist (application files) config (php.ini and 000-default.conf) Dockerfile

Then add the directory to the config.yml:

deploy:
artifact: dist.zip

I was then able to write a bash script to create a version number label and then deploy to Beanstalk:

eb deploy --staged --label {version_number}

Upvotes: 0

Sebastian
Sebastian

Reputation: 41

If you really want the dist files in your docker image then install gulp and run the command to generate the dist folder within the Dockerfile.

See the RUN command for Dockerfiles

Upvotes: 0

Related Questions