I am learning CICD with AWS codebuild. I use sqitch to manage database changes in my project. I have successfully configured docker-sqitch for the Snowflake database and it is working fine in the Ubuntu system. Now, I am trying to automate this thing so I have created an AWS ECR image for Snowflake and pushed it on AWS. It was successfully built and push it on ECR. But I don't know how to use it that ECR image with codebuild to manage my database change.
Here is my buildspec file:
version: 0.2
phases:
pre_build:
commands:
- export SQITCH_IMAGE=ccount_id.amazonaws.com/docker-snowflake-sqitch:latest
- echo Logging in to Amazon ECR...
- REPOSITORY_URI=account_id.amazonaws.com/docker-snowflake-sqitch
- echo Repository url is $REPOSITORY_URI
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
# - echo Repository url is $REPOSITORY_URI
- docker run -d $REPOSITORY_URI:latest
- docker ps
post_build:
commands:
- echo Build completed on `date`
- sqitch verify
I am getting an error while using sqitch command. So, can you please guide me on how to use ECR image with codebuild?