タスク定義反映
# タスク定義設定
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: deploy/task-definition-${{ env.DEPLOY_ENV }}.json
container-name: ECSコンテナ名
image: ${{ steps.build-image.outputs.image }}
# タスクデプロイ
id: deploy-task
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
cluster: ${{ env.ECS_CLUSTER }}
# マイグレーション実行
uses: noelzubin/
[email protected]
id: migration
with:
cluster: ECSクラスター名
task-definition: タスク定義名
subnets: ${{ env.SUBNETS }}
security-groups: ${{ env.SECURITY_GROUPS }}
assign-public-ip: ENABLED
override-container: ECSコンテナ名
override-container-command: |
sh
-c
. ./deploy/read-envs.sh && vendor/bin/phinx migrate -e ${{ env.PHINX_ENV }}
タスク定義jsonファイルを用意
{
"executionRoleArn": "AmazonECSTaskExecutionRolePolicyがあるIAM Role",
"containerDefinitions": [
{
"logConfiguration": {
"logDriver": "awslogs",
"secretOptions": null,
"options": {
"awslogs-group": "CloudWatch ロググループ",
"awslogs-region": "ap-northeast-1",
"awslogs-stream-prefix": "ecs"
}
},
"image": "ECRリポジトリURI",
"name": "名前"
}
],
"placementConstraints": [],
"family": "ファミリー名",
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"cpu": "256",
"memory": "512",
"volumes": []
}
deploy/task-definition-dev.json