Skip to content

Instantly share code, notes, and snippets.

@vickyRathee
Created January 9, 2021 10:04
Show Gist options
  • Save vickyRathee/06df1416d8bc5f2543c56e4d3b912e96 to your computer and use it in GitHub Desktop.
Save vickyRathee/06df1416d8bc5f2543c56e4d3b912e96 to your computer and use it in GitHub Desktop.
AWS CodeBuild buildspec.yml to build and test dot net 5 based application runtime.
# Based on https://github.com/PrakashTrove/AWS-CodeBuild-NetCore/blob/master/buildspec.yml
# AWS CodeBuild spec to build an Elastic Beanstalk artifact for AWS CodePipeline to deploy
version: 0.2
phases:
install:
runtime-versions:
dotnet: 5.0
#dotnet: latest - Latest resolve to 3.1, check this issue https://github.com/aws/aws-codebuild-docker-images/issues/414
pre_build:
commands:
- echo Restore started on `date`
- dotnet restore test-api/test-api.csproj
build:
commands:
- echo Build started on `date`
- dotnet build test-api/test-api.csproj
- echo Test started on `date`
- dotnet test test-api/test-api.csproj
post_build:
commands:
- echo Publish started on `date`
# https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-linux-platform-bundle-app.html
- dotnet publish -c Release -r linux-x64 -o ./ test-api/test-api.csproj
artifacts:
files:
- ./**/*
@DevDotJoel
Copy link

@DevDotJoel Its working fine on Ubuntu image, not on Amazon Linux.

but can u publish a release on linux if it's run on ubuntu?
Sorry i lack experience here

@tariqazmat101
Copy link

Yes you can publish a release using the Ubuntu image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment