Repository navigation
Remove Project Structure section from README #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to EKS | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| AWS_REGION: us-east-1 | |
| CLUSTER_NAME: landmark-eks-cluster | |
| DOCKER_REPO: landmark/devopsapp | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image_tag: ${{ steps.meta.outputs.tag }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set image tag | |
| id: meta | |
| run: echo "tag=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ${{ env.DOCKER_REPO }}:${{ steps.meta.outputs.tag }} | |
| ${{ env.DOCKER_REPO }}:latest | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build-and-push | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Update kubeconfig | |
| run: aws eks update-kubeconfig --name ${{ env.CLUSTER_NAME }} --region ${{ env.AWS_REGION }} | |
| - name: Set image in manifests | |
| run: | | |
| sed -i 's|ACCOUNT/REPO:TAG|${{ env.DOCKER_REPO }}:${{ needs.build-and-push.outputs.image_tag }}|g' kubernetes/03-deployment/deployment.yaml | |
| - name: Deploy to EKS | |
| run: | | |
| kubectl apply -f kubernetes/01-namespace/namespace.yaml | |
| kubectl apply -f kubernetes/04-configmap/configmap.yaml | |
| kubectl apply -f kubernetes/03-deployment/deployment.yaml | |
| kubectl apply -f kubernetes/03-deployment/service.yaml | |
| - name: Get LoadBalancer URL | |
| run: | | |
| echo "Waiting for LoadBalancer..." | |
| sleep 30 | |
| kubectl get svc landmark-app-service -n landmark -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' |