Reputation: 2034
Currently I have a AWS EB stack setup using the default 64bit Amazon Linux 2016.03 v2.1.3 running Node.js AMI.
Our codebase is written in ES6 and we use Babel to transpile the code into ES5. Our current deployment process is running babel locally to build the /dist
directory and commiting the dist into our git repository and using eb deploy
to deploy the application to EB.
I would like to be able to remove the step of building the distribution locally and perform this operation on the EB server.
I have tried using .ebextensions
with a command
to execute npm run build
which yields an error Return code: 127 Output: /bin/sh: npm: command not found.
. I have also tried using files
to insert the file into the appdeploy/pre
which yields the same error. And I have tried using container_commands
which also yields an error stating that npm
is not available.
Which of the available deployment hooks that AWS EB provides would be the correct place to use npm run build
?
Upvotes: 2
Views: 762
Reputation: 5930
You can use npm hooks.
For example:
Here I have a npm start
command that fires my server but before it I have a babel . -d ./dist
to compile the files on the dist directory. So I have a task called prestart
( using the npm hook pre naming convention ) that does that.
Upvotes: 1