Testing strapi build image #1
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: Build and Push Strapi to ECR (Test) | |
| on: | |
| push: | |
| branches: | |
| - strapi_ecr_image | |
| jobs: | |
| build-and-push: | |
| name: Build Docker Image and Push to Amazon ECR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Check and Install AWS CLI | |
| run: | | |
| if ! command -v aws &> /dev/null | |
| then | |
| echo "AWS CLI not found. Installing..." | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip awscliv2.zip | |
| sudo ./aws/install | |
| else | |
| echo "AWS CLI is already installed." | |
| aws --version | |
| fi | |
| - name: Log in to Amazon ECR | |
| run: | | |
| aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 325553860333.dkr.ecr.us-east-2.amazonaws.com | |
| - name: Build Docker Image | |
| run: | | |
| docker build -t openobserve/strapi . | |
| - name: Tag Docker Image | |
| run: | | |
| docker tag openobserve/strapi:latest 325553860333.dkr.ecr.us-east-2.amazonaws.com/openobserve/strapi:latest | |
| - name: Push Docker Image to Amazon ECR | |
| run: | | |
| docker push 325553860333.dkr.ecr.us-east-2.amazonaws.com/openobserve/strapi:latest |