Docker build fails in Travis CI - "Error checking context: 'syntax error in pattern'"

I have a .NET Core 2.1 project which I am building with Docker in Travis CI after running tests on it. The relevant parts (I think) of my travis build: .travis.yml: deploy: - provider: script ...