Developer Docs

C#Bot Deployment Notes

Step 1: Prepare Application

  1. Change directory into your [projectName]/serverside/src directory.
  2. Run dotnet publish -c Release

Step 2: Prepare Deployment Artefact

  1. Prepare the docker file i.e Dockerfile It’s contents should take the form

     FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
    	
     ENV "ServerSettings__ServerUrl" "https://beta.domainName.com.au" 
     ENV "ConnectionStrings__DbConnectionString" "Server=[DATABASEHOSTNAME];Database=[DATABASE];Username=postgres;Password=[PASSWORD]" 
     ENV "CertificateSetting__JwtBearerAuthority" "https://beta.domainName.com.au" 
     ENV "ASPNETCORE_URLS" "http://0.0.0.0:80" 
     # Beta mail trap ENV "EmailAccount__Host" "smtp.mailtrap.io" 
     ENV "EmailAccount__Username" "2702293ad75c53" 
     ENV "EmailAccount__Password" "xxxxxx" ENV "EmailAccount__FromAddress" "fromaddress@example.com" 
     ENV "EmailAccount__FromAddressDisplayName" "example" 
     ENV "EmailAccount__Port" "2525" 
    	
     EXPOSE 80 
     WORKDIR /usr/src/app/ 
     COPY ./[PROJECTNAME].App/ ./ 
     ENTRYPOINT ["dotnet", "[PROJECTNAME].dll"]
    
  2. Copy your application artefacts into the same directory as your Dockerfile. You can find this [projectName]/serverside/src/bin/Release/netcoreapp3.1/publish. You should find a collection of files.

  3. Build your image by running the following in the same directory as your dockerfile docker build . -t [projectName]/[version]

Step 3: Deploy

  1. Copy your new image to your deployment target either by pulling the docker image we created in the previous step or by copying and building the image as shown in step 2.

  2. Run your new artefact with docker run [projectName]/[version]

Was this article helpful?

Thanks for your feedback!

If you would like to tell us more, please click on the link below to send us a message with more details.

Tool:

Generate

Iterate

Bot:

C#Bot

SpringBot

On this page

New to Codebots?

We know our software can be complicated, so we are always happy to have a chat if you have any questions.