diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a2fcec7 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,35 @@ +name: ci + +on: + - push + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build and push container image + id: docker_build + uses: docker/build-push-action@v6 + with: + context: ./ + file: ./Dockerfile + push: true + tags: ${{ steps.login-ecr.outputs.registry }}/dittodining:${{ github.sha }} +# private repo로 전환한다면 아래와 같이 GitHub access token이 필요 +# build-args: | +# GH_ACCESS_TOKEN=${{ secrets.GH_ACCESS_TOKEN }} diff --git a/task-definition.json b/task-definition.json new file mode 100644 index 0000000..2deb6ca --- /dev/null +++ b/task-definition.json @@ -0,0 +1,55 @@ +{ + "containerDefinitions": [ + { + "name": "dittodining", + "image": "954976319012.dkr.ecr.ap-northeast-2.amazonaws.com/dittodining:latest", + "cpu": 0, + "portMappings": [ + { + "name": "server", + "containerPort": 8080, + "hostPort": 8080, + "protocol": "tcp", + "appProtocol": "http" + }, + { + "name": "database", + "containerPort": 3306, + "hostPort": 3306, + "protocol": "tcp", + "appProtocol": "http" + } + ], + "essential": true, + "environment": [], + "mountPoints": [], + "volumesFrom": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "/ecs/dittodining", + "mode": "non-blocking", + "awslogs-create-group": "true", + "max-buffer-size": "25m", + "awslogs-region": "ap-northeast-2", + "awslogs-stream-prefix": "ecs" + } + }, + "systemControls": [] + } + ], + "family": "dittodining", + "networkMode": "awsvpc", + "volumes": [], + "placementConstraints": [], + "requiresCompatibilities": [ + "EC2" + ], + "cpu": 256, + "memory": 256, + "runtimePlatform": { + "cpuArchitecture": "X86_64", + "operatingSystemFamily": "LINUX" + }, + "tags": [] +} \ No newline at end of file