$ docker-compose up --build$ docker-compose run --rm nodejs bash -c "npm install && npm run dev"Create 2 repositories for nginx and php-fpm.
Like below.
laravel-ecs-demo/nginxlaravel-ecs-demo/php-fpm
$ pip install awscli --upgrade
$ $(aws ecr get-login --no-include-email --region ${AWS_DEFAULT_REGION})$ docker build -t nodejs -f docker/nodejs/Dockerfile .
$ docker run --rm -v $(pwd):/build -w /build nodejs npm install
$ docker run --rm -v $(pwd):/build -w /build nodejs npm run dev$ docker build -t ${REPOSITORY_URI_PHP_FPM}:latest -f docker/php-fpm/Dockerfile .
$ docker build -t ${REPOSITORY_URI_NGINX}:latest -f docker/nginx/Dockerfile .$ docker tag ${REPOSITORY_URI_PHP_FPM}:latest ${REPOSITORY_URI_PHP_FPM}:$IMAGE_TAG
$ docker tag ${REPOSITORY_URI_NGINX}:latest ${REPOSITORY_URI_NGINX}:$IMAGE_TAG$ docker push ${REPOSITORY_URI_PHP_FPM}:latest
$ docker push ${REPOSITORY_URI_PHP_FPM}:$IMAGE_TAG
$ docker push ${REPOSITORY_URI_NGINX}:latest
$ docker push ${REPOSITORY_URI_NGINX}:$IMAGE_TAG| name | laravel-ecs-demo |
|---|---|
| Launch type | EC2 |
| name | php-fpm |
|---|---|
| image (uri) | ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/php-fpm:latest |
| working directory | /app |
| memory | 300 |
| name | nginx |
|---|---|
| image (uri) | ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/nginx:latest |
| port mapping | tcp 80:80 |
| memory | 300 |
| links | php-fpm |
| name | laravel-ecs-demo-cluster |
|---|---|
| cluster compatibility | EC2 Linux + Networking |
| EC2 Instance type | t2.small |
| Provisioning model | Spot |
| Number of instances | 2 |
| Maximum bid price (per instance/hour) | 10($) |
| Availability Zone | (Choose from VPC of ECS Cluster) |
|---|---|
| Listeners | HTTP 80 |
| Target instances | (Choose from Availability Zone) |
| Launch type | EC2 |
|---|---|
| Task definition | laravel-ecs-demo |
| Cluster | laravel-ecs-demo-cluster |
| Service name | laravel-ecs-demo |
| Service type | REPLICA |
| Load balancer type | Application Load Balancer |
| Container to load balance | nginx:80:80 |
| Listener port | 80:HTTP |
| Target Group | (Choose of ALB) |