I am using github actions, dockerfile to deploy container to AWS ecs.
But npm ERR is always raised after deploy task-definition to ECR.
I checked ECS container on EC2 instance with ssh. And I can API call in a few seconds but container stop soon.
I watched cloudwatch and find logs below.
I tried installing ts-node global, removing node_modules and npm cache... but error not disappear.
How to solve this? And where is the 2021-11-10T13_02_58_148Z-debug.log? I can not find this on container...
npm ERR! path /test
2021-11-10T22:02:58.147+09:00 npm ERR! command failed
2021-11-10T22:02:58.147+09:00 npm ERR! signal SIGTERM
2021-11-10T22:02:58.147+09:00 npm ERR! command sh -c NODE_ENV=prod ts-node app.ts
2021-11-10T22:02:58.156+09:00 npm ERR! A complete log of this run can be found in:
2021-11-10T22:02:58.156+09:00 npm ERR! /root/.npm/_logs/2021-11-10T13_02_58_148Z-debug.log
package.json
{
"name": "test-package",
"version": "1.0.0",
"description": "",
"dependencies": {
"@types/express": "^4.17.13",
"@types/node": "^16.11.7",
"ajv": "^6.12.6",
"aws-sdk": "^2.1015.0",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"hardhat": "^2.6.6",
"power-di": "^2.4.14",
"tslint": "^6.1.3",
"typescript": "^4.4.4"
},
"scripts": {
"start:prod": "NODE_ENV=prod ts-node app.ts",
},
"devDependencies": {
"@types/chai": "^4.2.22",
"@types/mocha": "^9.0.0",
"@types/supertest": "^2.0.11",
"chai": "^4.3.4",
"mocha": "^9.1.3",
"supertest": "^6.1.6"
}
}
FROM node:16-alpine
RUN mkdir /test
WORKDIR /test
COPY . /test
RUN npm update
RUN npm i
RUN npm i -g ganache-cli
RUN npm i -g ts-node
EXPOSE 3000
ENTRYPOINT ["npm", "run", "start:prod"]