-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to run on docker image #1358
Comments
Note: I tried running |
Looks like You should be able to install |
Just tried (took the code form this Dockerfile):
which gives me the error:
|
Try this + FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS core-tools-build-env
+ RUN wget https://github.com/Azure/azure-functions-core-tools/archive/master.tar.gz && \
+ tar -xzvf master.tar.gz && \
+ cd azure-functions-core-tools-* && \
+ dotnet publish src/Azure.Functions.Cli/Azure.Functions.Cli.csproj --runtime linux-musl-x64 --output /output
FROM docker:latest
RUN apk update && apk upgrade && apk add make py-pip
RUN apk add --virtual=build gcc libffi-dev musl-dev openssl-dev python2-dev
RUN pip install azure-cli && apk del --purge build
RUN apk add --update nodejs nodejs-npm
- RUN npm i -g azure-functions-core-tools@latest --unsafe-perm true
+ # .NET Core dependencies
+ RUN apk add --no-cache ca-certificates krb5-libs libgcc libintl libssl1.1 libstdc++ lttng-ust tzdata userspace-rcu zlib
+ ENV DOTNET_RUNNING_IN_CONTAINER=true \
+ DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
+ COPY --from=core-tools-build-env [ "/output", "/azure-functions-core-tools" ]
+ RUN ln -s /azure-functions-core-tools/func /bin/func
RUN func -v see this for dotnet core alpine dependencies https://github.com/dotnet/dotnet-docker/blob/master/2.1/runtime-deps/alpine3.9/amd64/Dockerfile |
and since the change above is building master, you won't get the right version injected. Master branch is always the latest released cli, but the build number is injected during build. You can pass the build number to |
@ahmelsayed thanks that worked I'm actually trying to publish Python function apps using Gitlab, who has a Docker in Docker service. I am currently deploying on Travis-CI, which works fine but wanted to move the deployment to a private gitlab server. Using the above image on Gitlab, the deployment uploads |
Sorry I'm trying to understand your scenario. I'd recommend not using an alpine base if that were the case. The problem with alpine and python is that it doesn't use standard glibc and uses musl-libc instead. a lot of python packages (numpy, tensorflow, etc) would require a compile step for their C/C++ dependencies, and building those on alpine would not produce valid native binaries to run on our Azure host which is Debian based (uses glibc) The core-tools spins up an instance of # https://github.com/Azure/azure-functions-core-tools/blob/dev/src/Azure.Functions.Cli/StaticResources/python_docker_build.sh
pip install --target=".python_packages/lib/python3.6/site-packages" -r requirements.txt That's all to say if you want things to just work in a gitlab environment you can achieve that by this Dockerfile instead FROM mcr.microsoft.com/azure-functions/python:2.0.12493-python3.6-buildenv
# Install azure-cli
RUN apt-get update && apt-get install apt-transport-https lsb-release software-properties-common dirmngr -y && \
AZ_REPO=$(lsb_release -cs) && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
tee /etc/apt/sources.list.d/azure-cli.list && \
apt-key --keyring /etc/apt/trusted.gpg.d/Microsoft.gpg adv \
--keyserver packages.microsoft.com \
--recv-keys BC528686B50D79E339D3721CEB3E94ADBE1229CF && \
apt-get update && \
apt-get install -y azure-cli
# Install azure-functions-core-tools
RUN apt-get update && \
apt-get install -y azure-functions-core-tools Then your build/publish script that runs in that above container can just be # cd to WORKING DIR
# Build your python functions
pip install --target=".python_packages/lib/python3.6/site-packages" -r requirements.txt
# Login into azure
az login --service-principal -u "$AZURE_SP_ID" -p "$AZURE_SP_KEY" --tenant "$AZURE_SP_TENANT"
# set your default sub (optional)
az account set --subscription $AZURE_SUBSCRIPTION
# publish your functions
func azure functionapp publish {app-name} --no-build |
@ahmelsayed yes that worked perfectly! I added |
@ahmelsayed continuing on this, I have a package that needs a program in
I am guessing that running |
@mebibou sorry for the delay. No, in general we only assume that what you're publishing is a layer on top of I was looking at enabling custom docker containers for that scenario, though the startup time is very high today and we want to drive it down to something reasonable before enabling custom containers deployment. I don't know if pip has a way to put these files somewhere that's not |
I'm actually running this completely on Docker directly for now, and I install it using |
@mebibou I guess you could move whatever binaries you need to |
@mlazowik how would I be able to add them to the |
I think if you set Setting I think adding a way to prepend |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am trying to install and run it on the
docker
image as follows:But when building the image, it fails at
func -v
:I saw 2 other issues that mention a similar error, but they seem either resolve magically or not on the same os/machine: #1136 and #167
The text was updated successfully, but these errors were encountered: