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

does it still work? i have a .net 5 app on codecommit. Every time i try build the app in the linux amazon the latest version is 3.1
Is there any workaround?

@vickyRathee
Copy link
Author

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

@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.

@atul7970
Copy link

If I want to generate DLL file then?

@atul7970
Copy link

Like I am using AWS CodeBuild and want to store the artifact as DLL file in S3

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