1
votes

I want to build my project in AWS with ASP.NET Core 2.2, and since AWS unfortunately does not have their own build image available for that, I'm trying to use the Docker image mcr.microsoft.com/dotnet/core/sdk:2.2.

It was getting stuck on pip install --upgrade awscli... I think because pip is not installed on the image. So I've tried to fix that by installing pip and I am getting this error:

Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: apt-get install python3-dev. Reason: exit status 1

My troubleshooting attempts have included:

  • toggling the Privileged flag for the CodeBuild Environment
  • including and not including sudo in my buildspec.yml commands
  • trying both pip and pip3

Here is my current buildspec.yml:

version: 0.2
phases:
  pre_build:
    commands:
      - apt-get update --fix-missing
      - apt-get install -y apt-transport-https
      - apt-get update
      - apt-get install python3-dev
      - apt-get install python3-pip
      - pip3 install --upgrade awscli
      - dotnet restore AspNetCoreWebApplication/AspNetCoreWebApplication.csproj
      - dotnet restore AspNetCoreWebApplicationTest/AspNetCoreWebApplicationTest.csproj
  build:
    commands:
      .....the rest omitted for brevity......

My question is why is this not working?

1
the error is coming in the python install it seems. .. did u check that the image has python on it ? - Krunal Barot

1 Answers

1
votes

Found the problem. These commands:

apt-get install python3-dev
apt-get install python3-pip

need to include the -y flag to automatically say yes to any prompts from the commands.

Adding the flags like this works:

apt-get install -y python3-dev
apt-get install -y python3-pip