I have had an Azure webapp up and running the last couple of years.
It is basically Python code and fastAPI running a backend that I call from a separate website.
During this period I have updated the code sucessfully several times, and uploaded it to Azure.
Today, I made a few updates to the Python code, and then tried to redeploy the app.
The code is running fine, when I test it on my local computer. However, I was unable to get it back up on Azure...
My Dockerfile is given below:
FROM python:3.9.5
EXPOSE 2222 80 8000 22 8080
#not sure how many of these are needed....
RUN apt-get update && apt-get install -y \
dos2unix \
apt-utils \
gcc \
antiword \
unixodbc-dev \
odbcinst1debian2 \
unixodbc \
libodbc1 \
curl \
libpcre3 \
libc6 \
libstdc++6 \
libkrb5-3 \
openssl \
debconf \
openssh-server \
libleptonica-dev \
python3-opencv \
tesseract-ocr \
libtesseract-dev \
tesseract-ocr-eng \
tesseract-ocr-script-latn \
imagemagick \
libsm6 \
libxext6 \
libgl1-mesa-glx
#to solve the problem with the db REF::
#https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17
#Copy and install everything at ./
COPY requirements.txt .
RUN pip install -r requirements.txt --no-cache-dir
COPY white_list.txt .
COPY namelist.txt .
COPY org_names.txt .
COPY health.txt .
COPY blankIT_db_stuff.py .
COPY blankIT_utils.py .
COPY blankitbe.py .
COPY . /app
WORKDIR /app
#the lines below added Dec23 - as suggested by stack overflow
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--workers", "1", "--timeout", "360", "--log-level", "debug", "blankitbe:app"]
And the commands i run in the Azure window is:
az login
az acr build --registry blankitbeAppRegistry --resource-group blankitbeApp --image blankitbe-app .
az appservice plan create -g blankitbeApp -n blankitbeAppServicePlan -l westeurope --is-linux --sku P3V2
az webapp create -g blankitbeApp -p blankitbeAppServicePlan -n blankitbe-web-app -i blankitbeAppregistry.azurecr.io/blankitbe-app:latest
This all seem to install ok, but the webapp does not start... :-(
From the log (see below) it appears as if there s a problem with gunicorn or some PATH, but i do not understand?
Help would be much appreciated.
The log files now say:
2023-12-10T17:10:36.862Z ERROR - Container start failed for blankitbe-web-app_0_e71529ab with System.AggregateException, One or more errors occurred. (Docker API responded with status code=BadRequest, response={"message":"failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: \"gunicorn\": executable file not found in $PATH: unknown"}