Merge pull request #2877 from tekdi/prod-fix-new #76
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 PROD Teacher | |
| on: | |
| push: | |
| branches: | |
| - main-teacher-prod | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Clone the repository | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Step 2: Create a .env file | |
| - name: Create .env file | |
| run: echo "${{ secrets.PROD_LMP_ENV }}" > .env && ls -ltra | |
| # Step 4: Build and tag the Docker image | |
| - name: Build Docker image | |
| run: | | |
| docker build -f Dockerfile.teachers -t ${{ secrets.ECR_REPO_NAME_LMP_PROD }}:${{ secrets.IMAGE_TAG_LMP }} . | |
| # Step 5: Push the Docker image to Amazon ECR | |
| - name: Push Docker image to ECR | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| run: | | |
| aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID | |
| aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY | |
| aws configure set default.region ${{ secrets.AWS_REGION }} | |
| aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_URI_PROD_LMP }} | |
| docker push ${{ secrets.ECR_REPO_NAME_LMP_PROD }}:${{ secrets.IMAGE_TAG_LMP }} | |
| # Step 6: Remove Docker image from GitHub Actions runner | |
| - name: Remove Docker image from runner | |
| run: | | |
| docker rmi ${{ secrets.ECR_REPO_NAME_LMP_PROD }}:${{ secrets.IMAGE_TAG_LMP }} |