diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c67963d..60f9894 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,6 +11,12 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Setup kubectl + uses: azure/setup-kubectl@v4 + id: install + with: + version: "v1.29.3" + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -36,3 +42,13 @@ jobs: run: | docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + + - name: Set kube config + run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER }} --region ${{ secrets.AWS_REGION }} + + - name: Deploy changes to EKS cluster + env: + IMAGE: ${{steps.login-ecr.outputs.registry}}/${{secrets.AWS_ECR_REPOSITORY}}:${{github.sha}} + run: | + kubectl apply -f eks/deployment.yml + kubectl apply -f eks/service.yml diff --git a/Dockerfile b/Dockerfile index a85515b..6ad7d28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ COPY --from=builder /app/server . COPY --from=builder /app/migrate . COPY app.env . -COPY start.sh . +COPY scripts/start.sh . COPY sql/migrations/ ./sql/migrations/ CMD ["server"] diff --git a/cluster.yml b/eksctl/cluster.yml similarity index 100% rename from cluster.yml rename to eksctl/cluster.yml diff --git a/start.sh b/scripts/start.sh similarity index 100% rename from start.sh rename to scripts/start.sh