Updating gcc for Azure function in R with Docker

Mislav Sagovac 21 Reputation points
2022-11-02T11:16:16.157+00:00

Hello,

I am trying to deploy an Azure function in R with Docker. Certain packages require gcc >= 9 (C++17) but
I am unable to update it.

Dockerfile:

FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice   
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \  
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true  
  
RUN apt-get install -y r-base r-base-dev  
RUN apt-get update -qq && apt-get install -y \   
   libssl-dev \   
   libcurl4-gnutls-dev \  
   libsodium-dev \  
   libxml2-dev  
  
RUN apt-get install -y gcc  
RUN gcc --version   
  
COPY  install_packages.R install_packages.R  
RUN Rscript /install_packages.R  
COPY . /home/site/wwwroot  

Do you have any suggestions on how to update gcc or install R with the correct version of gcc?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,120 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,264 questions
{count} votes

Accepted answer
  1. Andriy Bilous 10,736 Reputation points MVP
    2022-11-04T11:13:39.307+00:00

    Hello @Mislav Sagovac

    According to Microsoft Dockerhub repo you are using image mcr.microsoft.com/azure-functions/dotnet:3.0-appservice based on Debian 10 (Buster)
    Unfortunately there is no gcc-9 or higher version of this package for Debian 10 (Buster)
    https://packages.debian.org/search?keywords=gcc-9

    I could suggest you to use newer Microsoft Dockerhub image mcr.microsoft.com/azure-functions/dotnet:4.0-appservice
    or try to build it from sources https://gist.github.com/s3rvac/76ac07f21d5635209accc11fa56bd3fb
    You will need to add few commands into your Dockerfile

    ADD "https://gist.githubusercontent.com/s3rvac/76ac07f21d5635209accc11fa56bd3fb/raw/70c33cf0121348aa33a2159449ac64afcfac01b0/gcc-10-debian-buster.sh" /script/gcc-10-debian-buster.sh  
    RUN chmod +x /script/gcc-10-debian-buster.sh  
    RUN /script/gcc-10-debian-buster.sh  
    

    If you think your question has been answered, click "Mark as Accept Answer" if just helped click "Vote as helpful". This can be beneficial to other community members reading this forum thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful