paketo-buildpacks / dotnet-core

A Cloud Native Buildpack for .NET Core
Apache License 2.0
46 stars 4 forks source link

$PATH not updated in running container #630

Closed akitson-degreed closed 2 years ago

akitson-degreed commented 2 years ago

What happened?

I am attempting to use skaffold to debug my container, and one of the requirements is that dotnet must be available on the path. However, it is not on the path of the built container.

Build Configuration

project.toml:

[[ build.env ]]
  name = 'BP_DOTNET_FRAMEWORK_VERSION'
  value = '5.0.12'
[[ build.env ]]
  name = 'BP_DOTNET_PROJECT_PATH'
  value = './src/VisierUtility'
[[ build.env ]]
  name = 'BPE_ASPNETCORE_FORWARDEDHEADERS_ENABLED'
  value = 'true'
[[ build.env ]]
  name = 'BPE_DOTNET_SYSTEM_GLOBALIZATION_INVARIANT'
  value = '1'
[[ build.env ]]
  name = 'BP_DOTNET_PUBLISH_FLAGS'
  value = '--configuration Debug -p:UseAppHost=false'

LOG from build:

===> DETECTING
[detector] 8 of 12 buildpacks participating
[detector] paketo-buildpacks/ca-certificates       3.0.1
[detector] paketo-buildpacks/dotnet-core-runtime   0.5.1
[detector] paketo-buildpacks/dotnet-core-aspnet    0.5.1
[detector] paketo-buildpacks/dotnet-core-sdk       0.5.2
[detector] paketo-buildpacks/icu                   0.1.0
[detector] paketo-buildpacks/dotnet-publish        0.5.1
[detector] paketo-buildpacks/dotnet-execute        0.7.0
[detector] paketo-buildpacks/environment-variables 4.0.1
===> ANALYZING
[analyzer] Restoring metadata for "paketo-buildpacks/ca-certificates:helper" from app image
[analyzer] Restoring metadata for "paketo-buildpacks/dotnet-core-runtime:dotnet-core-runtime" from app image
[analyzer] Restoring metadata for "paketo-buildpacks/dotnet-core-aspnet:dotnet-core-aspnet" from app image
[analyzer] Restoring metadata for "paketo-buildpacks/dotnet-core-sdk:dotnet-core-sdk" from cache
[analyzer] Restoring metadata for "paketo-buildpacks/icu:icu" from app image
[analyzer] Restoring metadata for "paketo-buildpacks/environment-variables:environment-variables" from app image
===> RESTORING
[restorer] Restoring data for "paketo-buildpacks/dotnet-core-runtime:dotnet-core-runtime" from cache
[restorer] Restoring data for "paketo-buildpacks/dotnet-core-aspnet:dotnet-core-aspnet" from cache
[restorer] Restoring data for "paketo-buildpacks/dotnet-core-sdk:dotnet-core-sdk" from cache
[restorer] Restoring data for "paketo-buildpacks/icu:icu" from cache
===> BUILDING
[builder]
[builder] Paketo CA Certificates Buildpack 3.0.1
[builder]   https://github.com/paketo-buildpacks/ca-certificates
[builder]   Launch Helper: Reusing cached layer
[builder] Paketo .NET Core Runtime Buildpack 0.5.1
[builder]   Resolving Dotnet Core Runtime version
[builder]     Candidate version sources (in priority order):
[builder]       BP_DOTNET_FRAMEWORK_VERSION -> "5.0.12"
[builder]       VisierUtility.csproj        -> "5.0.0"
[builder]       <unknown>                   -> ""
[builder]
[builder]     Selected dotnet-runtime version (using BP_DOTNET_FRAMEWORK_VERSION): 5.0.12
[builder]
[builder]   Reusing cached layer /layers/paketo-buildpacks_dotnet-core-runtime/dotnet-core-runtime
[builder]
[builder] Paketo ASP.NET Core Buildpack 0.5.1
[builder]   Resolving Dotnet Core ASPNet version
[builder]     Candidate version sources (in priority order):
[builder]       RUNTIME_VERSION             -> "5.0.12"
[builder]       BP_DOTNET_FRAMEWORK_VERSION -> "5.0.12"
[builder]       VisierUtility.csproj        -> "5.0.0"
[builder]       <unknown>                   -> ""
[builder]
[builder]     Selected dotnet-aspnetcore version (using RUNTIME_VERSION): 5.0.12
[builder]
[builder]   Reusing cached layer /layers/paketo-buildpacks_dotnet-core-aspnet/dotnet-core-aspnet
[builder]
[builder] Paketo .NET Core SDK Buildpack 0.5.2
[builder]   Resolving .NET Core SDK version
[builder]     Candidate version sources (in priority order):
[builder]       RUNTIME_VERSION      -> "5.0.403"
[builder]       <unknown>            -> "*"
[builder]       VisierUtility.csproj -> "5.0.*"
[builder]
[builder]     Selected .NET Core SDK version (using RUNTIME_VERSION): 5.0.403
[builder]
[builder]   Reusing cached layer /layers/paketo-buildpacks_dotnet-core-sdk/dotnet-core-sdk
[builder]
[builder]   Configuring environment
[builder]     DOTNET_ROOT -> "/workspace/.dotnet_root"
[builder]     PATH        -> "/workspace/.dotnet_root:$PATH"
[builder]
[builder] Paketo ICU Buildpack 0.1.0
[builder]   Reusing cached layer /layers/paketo-buildpacks_icu/icu
[builder]
[builder] Paketo .NET Publish Buildpack 0.5.1
[builder]   Executing build process
[builder]     Running 'dotnet publish /workspace/src/VisierUtility --runtime ubuntu.18.04-x64 --self-contained false --output /tmp/dotnet-publish-output3070759734 --configuration Debug -p:UseAppHost=false'
[builder]       Completed in 13.9169205s
[builder]
[builder]   Removing source code
[builder]
[builder] Paketo .NET Execute Buildpack 0.7.0
[builder]   Assigning launch processes
[builder]     web: dotnet /workspace/VisierUtility.dll --urls http://0.0.0.0:${PORT:-8080}
[builder]
[builder]
[builder] Paketo Environment Variables Buildpack 4.0.1
[builder]   https://github.com/paketo-buildpacks/environment-variables
[builder]   Launch Configuration:
[builder]     $BPE_<NAME>                prepend value to $NAME, delimiting with OS path list separator
[builder]     $BPE_APPEND_<NAME>         append value to $NAME
[builder]     $BPE_DEFAULT_<NAME>        set default value for $NAME
[builder]     $BPE_DELIM_<NAME>          set delimeter to use when appending or prepending to $NAME
[builder]     $BPE_OVERRIDE_<NAME>       set $NAME to value
[builder]     $BPE_PREPEND_<NAME>        prepend value to $NAME
[builder]   Environment Variables: Reusing cached layer
===> EXPORTING
[exporter] Reusing layer 'paketo-buildpacks/ca-certificates:helper'
[exporter] Reusing layer 'paketo-buildpacks/dotnet-core-runtime:dotnet-core-runtime'
[exporter] Reusing layer 'paketo-buildpacks/dotnet-core-aspnet:dotnet-core-aspnet'
[exporter] Reusing layer 'paketo-buildpacks/dotnet-core-sdk:dotnet-env-var'
[exporter] Reusing layer 'paketo-buildpacks/icu:icu'
[exporter] Reusing layer 'paketo-buildpacks/environment-variables:environment-variables'
[exporter] Reusing 1/1 app layer(s)
[exporter] Reusing layer 'launcher'
[exporter] Reusing layer 'config'
[exporter] Reusing layer 'process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving visier-utility:latest...
[exporter] *** Images (e96f729cbe41):
[exporter]       visier-utility:latest
[exporter] Reusing cache layer 'paketo-buildpacks/dotnet-core-runtime:dotnet-core-runtime'
[exporter] Reusing cache layer 'paketo-buildpacks/dotnet-core-aspnet:dotnet-core-aspnet'
[exporter] Reusing cache layer 'paketo-buildpacks/dotnet-core-sdk:dotnet-core-sdk'
[exporter] Reusing cache layer 'paketo-buildpacks/icu:icu'

Checklist

sophiewigmore commented 2 years ago

Hi @akitson-degreed 👋 That is strange. On the running container, can you post what the output of echo $PATH? Also what command are you running to build the app / and then enter the container?

When you run the container with docker you may need to add an --entrypoint launcher since that sets the env. I'd expect the command to look like: docker run -it --entrypoint=launcher visier-utility /bin/bash

fg-j commented 2 years ago

Closing for now since this has gone stale. Please reopen if you're still seeing this problem.