Last active
March 31, 2021 11:28
-
-
Save rfpedrosa/6079c5e0fa07ff5f0491407427810be8 to your computer and use it in GitHub Desktop.
AWS CodePipeline: run migrations in AWS CodeBuild
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
# Based on https://github.com/PrakashTrove/AWS-CodeBuild-NetCore/blob/master/buildspec.yml | |
# AWS CodeBuild spec to run Entity Framework migrations before a deployment | |
# In order to AWS CodeBuild has access to RDS, I had to manually setup a Inbound rule: | |
# https://ctoasaservice.org/2019/01/23/aws-codebuild-and-access-to-rds/ | |
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
dotnet: latest | |
commands: | |
- echo Installing Entity Framework Core tools reference - .NET CLI | |
- dotnet tool install --global dotnet-ef | |
pre_build: | |
commands: | |
- echo ASPNETCORE_ENVIRONMENT is $ASPNETCORE_ENVIRONMENT | |
- echo $ConnectionStrings__DBContext | |
- echo Info about dbcontext | |
- dotnet ef dbcontext info | |
build: | |
commands: | |
- echo Update database on `date` | |
- dotnet ef database update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment