Closed wrsuarez closed 7 years ago
hello @wrsuarez !
Thank you for the report ! Iron base containers are configured to be minimal, to make them take as little space as possible.
However, you don't have to keep to using Iron provided base containers. By default, fn
tool tries to be smart, and provide you with a default container & Dockerfile
based on your application. However, you can also use any configuration you like if you provide a custom Dockerfile
.
In this case, the base Dockerfile
fn
tool presumes is :
Adding some necessary dependencies for paramiko, a Dockerfile
like below should solve your problem :
FROM iron/python:2
RUN apk update && apk upgrade
RUN apk add --no-cache curl python pkgconfig python-dev openssl-dev libffi-dev musl-dev make gcc
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python
WORKDIR /app
ADD . /app
RUN pip install -U setuptools
RUN python -m pip install --upgrade pip
RUN pip install -t packages -r requirements.txt
ENTRYPOINT ["python", "func.py"]
Or, checking dockerhub for paramiko, you can use another base container which includes all these deps and end up with a cleaner Dockerfile
:
FROM eduardoshanahan/paramiko
WORKDIR /app
ADD . /app
RUN pip install -t packages -r requirements.txt
ENTRYPOINT ["python", "func.py"]
In this case, the base container doesn't seem to contain pip
, so this doesn't work. But the point is there might be other containers out there serving your needs built by other people, so you can base your app on these containers as well. You are not confined to Iron provided containers.
I hope this solves your issue, let us know how it works !
closing this for now, please feel free to open if something is not clear. 👍
Trying to write a function which needs to SSH into another system to get some data and leveraging the paramiko library to do so. When including paramiko in the requirements file the python-dev container complains about gcc when trying to compile the required libraries for paramiko:
MYLAPTOP:projectdir me$ fn build Running prebuild command: docker run --rm -v /Users/me/project:/worker -w /worker iron/python:2-dev pip install -t packages -r requirements.txt Collecting PyNaCl (from -r requirements.txt (line 1)) Downloading PyNaCl-1.1.2.tar.gz (3.1MB) Complete output from command python setup.py egg_info: unable to execute 'gcc': No such file or directory unable to execute 'gcc': No such file or directory
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-8DHlH1/PyNaCl You are using pip version 8.0.2, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. error running docker build: exit status 1