Open vijayarajanv opened 1 year ago
Hi @vijayarajanv it would be helpful if you could update your issue and reformat it to use the issue template https://github.com/openfaas/faas/blob/master/.github/ISSUE_TEMPLATE.md
It is not quite clear to me how your issue is related to OpenFaaS. It looks like you are having a problem with your application code or docker that is not directly related to OpenFaaS.
Please start by clearly filling out the issue template.
Han
I have created a docker base image with my dependencies needed to run my application like Java, Python, VC++ and dotnet. On top of the base image, I am creating another docker image(application image) which copies my application(asp.net core Web API) so that it runs my API from browser. In this process when I am trying to create a container on top of my application image, I am getting the following error:
I am not sure why this error is coming as my two images got created without any issues and if I checked in my images I see all my dependencies got installed properly and my app code copied inside the image.
Below are the two docker file contents which I am trying to run:
Base Image Dockerfile code:
FROM mcr.microsoft.com/windows/servercore:ltsc2019-amd64 AS installer
install vc++
COPY VC_redist.x64.exe . RUN c:\VC_redist.x64.exe /install /passive /norestart /log out.txt
install Python
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] WORKDIR C:/temp/Python
RUN New-Item C:/temp -ItemType Directory; New-Item C:/data -ItemType Directory;
ENV PYTHON_VERSION 3.10.4 ENV PYTHON_RELEASE 3.10.4
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ \ Write-Host 'Installing ...'; \
https://docs.python.org/3.10.4/using/windows.html#installing-without-ui
the installer updated PATH, so we should refresh our local value
https://github.com/pypa/get-pip
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py ENV PYTHON_GET_PIP_SHA256 421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e
RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py'; \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256); \ if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) { \ Write-Host 'FAILED!'; \ exit 1; \ }; \ \ Write-Host ('Installing pip ...'); \ python get-pip.py \ --disable-pip-version-check \ --no-cache-dir \ ; \ Remove-Item get-pip.py -Force; \ \ Write-Host 'Verifying pip install ...'; \ pip --version; \ \ Write-Host 'Complete.'
install Java
MAINTAINER Zulu Enterprise Container Images azul-zulu-images@microsoft.com
RUN setx PACKAGE zulu-8-azure-jdk_8.58.0.13-8.0.312-win_x64.msi RUN setx PACKAGE_DIR zulu-8/8u312 RUN setx /m JAVA_HOME "C:\temp\Zulu\zulu-8" RUN setx /m JAVA_HOME "C:\temp\Zulu\zulu-8\bin"
RUN powershell -Command [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;(new-object System.Net.WebClient).DownloadFile('https://repos.azul.com/azure-only/zulu/packages/zulu-8/8u312/zulu-8-azure-jdk_8.58.0.13-8.0.312-win_x64.msi', 'C:\%PACKAGE%') RUN msiexec /quiet /i C:\%PACKAGE% RUN del C:\%PACKAGE%
RUN setx PACKAGE zulu-8-azure-jre_8.58.0.13-8.0.312-win_x64.msi RUN setx PACKAGE_DIR zulu-8/8u312 RUN setx /m JAVA_HOME "C:\temp\zulu-8-jre" RUN setx /m JAVA_HOME "C:\temp\zulu-8-jre\bin"
RUN powershell -Command [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;(new-object System.Net.WebClient).DownloadFile('https://repos.azul.com/azure-only/zulu/packages/zulu-8/8u312/zulu-8-azure-jre_8.58.0.13-8.0.312-win_x64.msi', 'C:\%PACKAGE%') RUN msiexec /quiet /i C:\%PACKAGE% RUN del C:\%PACKAGE%
RUN powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -UseBasicParsing -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1; ./dotnet-install.ps1 -InstallDir '/Program Files/dotnet' -Channel 6.0 -Runtime dotnet; RUN Remove-Item -Force dotnet-install.ps1
RUN setx /M PATH "%PATH%;C:\dotnet"
Image which I created for my Web API on top of the above base image:
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build-env WORKDIR /Program Files/dotnet COPY *.csproj ./ RUN dotnet restore COPY . ./ RUN dotnet publish -c Release -o out
FROM newbaseimage:5.0 as runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as runtime
FROM newbaseimage:5.0 as installer
WORKDIR /Program Files/dotnet COPY --from=build-env /app/out .
COPY VC_redist.x64.exe .
RUN VC_redist.x64.exe /install /passive /norestart /log out.txt
EXPOSE 80 ENTRYPOINT ["dotnet", "TestDesignStudioAPI.dll"]
Environment variables to connect to Azure
ENV AZURE_CLIENT_ID=6baec3cf-e284-4db8-8576-5af4320f3849 \ AZURE_CLIENT_SECRET=LOm8Q~UM7fQDLFSsuvgnzv9wsTE2zFtsQAa4WbjQ \ AZURE_TENANT_ID=0fe67bdb-a749-4082-a35f-fa9f9579a348
Can anyone please suggest what I am doing wrong here?