MinimalNugetServer
MinimalNugetServer copied to clipboard
File configuration.json missing in docker build
Repro:
$ git clone https://github.com/TanukiSharp/MinimalNugetServer.git
$ cd MinimalNugetServer/MinimalNugetServer/scripts
$ chmod +x make_publishable.sh
$ ./make_publishable.sh
$ cd ../..
$ docker build -t minimal-nuget-server -f Dockerfile .
$ docker run --rm minimal-nuget-server
Unhandled Exception: System.IO.FileNotFoundException: The configuration file 'configuration.json' was not found and is not optional. The physical path is '/dotnetapp/configuration.json'.
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at MinimalNugetServer.Program.Main(String[] args) in /src/MinimalNugetServer/Program.cs:line 25
But running manually works (after the above):
$ cd MinimalNugetServer
$ dotnet run
So something is definitely up with the docker packaging.
I fixed that by setting a project property to copy the configuration.json
file when building.
That also work when the Dockerfile calls the publish
command.
See commit e9d0cad4ae75b3ed869dbac68ac04bccf1d39e49
Keep in mind that the default configuration is just a sample, you have to modify it to match your environment before building your Docker image.
Let me know how it goes. Thanks.