dockerfile #2
This file contains 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: WaveNET Challenge | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
setup-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check for merge conflicts | |
id: check-conflicts | |
run: | | |
! git ls-files -u | grep -q . | |
continue-on-error: true | |
- name: Fail on merge conflict | |
if: steps.check-conflicts.outcome == 'failure' | |
run: | | |
echo "Merge conflicts detected, failing the pipeline." | |
exit 1 | |
- name: Set up Docker Environment | |
run: sudo chmod +x /var/run/docker.sock | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login to Amazon ECR | |
run: | | |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REPO_URL }} | |
- name: Build Docker image | |
run: docker build . -t ${{ secrets.ECR_REPO_URL }}:${{ github.sha }} | |
- name: Push Docker image to Amazon ECR | |
run: docker push ${{ secrets.ECR_REPO_URL }}:${{ github.sha }} |