0

I have followed the tutorial for the Azure Functions using python. everything wen smooth. for the next step I need to add a C compiled dependency. I just added the C compiler + the dependency script rows. I have edited the Docker file and it now looks like this:

FROM mcr.microsoft.com/azure-functions/python:3.0-python3.7

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY requirements.txt /
RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot

FROM julia:1.3
RUN apt-get update && apt-get install -y gcc g++ && rm -rf /var/lib/apt/lists/*

FROM python:3.7
RUN pip install numpy 

RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
  tar -xvzf ta-lib-0.4.0-src.tar.gz && \
  cd ta-lib/ && \
  ./configure --prefix=/usr && \
  make && \
  make install

RUN rm -R ta-lib ta-lib-0.4.0-src.tar.gz

When I build this docker file it look good. but when I run it it just opens up a GCC promp.

What am I doing wrong?

Thanks

1 Answer 1

2

I found an issue with your multi stage FROM statements. Also, you needed to add apt-get install make. The following works:

FROM mcr.microsoft.com/azure-functions/python:3.0-python3.7

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY requirements.txt /
RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot

# Adding "apt-get install make" here
RUN apt-get update && apt-get install make && apt-get install -y gcc g++ && rm -rf /var/lib/apt/lists/*

RUN pip install numpy 

RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
  tar -xvzf ta-lib-0.4.0-src.tar.gz && \
  cd ta-lib/ && \
  ./configure --prefix=/usr && \
  make && \
  make install

RUN rm -R ta-lib ta-lib-0.4.0-src.tar.gz
Sign up to request clarification or add additional context in comments.

2 Comments

hey. I tried using your Dockerfile it builds but when I try to run it this is what I am getting and he is not accessible through localhost:8080: PS D:\AzureFunctionTest> docker run -p 8080:80 -it 94073419f251 Python 3.7.11 (default, Jun 29 2021, 20:31:06) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
Have you cross checked the image id? Try deleting previous images and then build again and then use the new image id. Because it is working fine at my end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.