Closed apiri closed 6 years ago
Thanks for reporting this @apiri I'll do some research, from a bit of quick reading it looks like the dependencies for cryptography aren't being handled well.
Can you advise if this needs an urgent resolution to help you move forward , or is it more in the nature of 'this didn't work, and it would be convenient if it did'?
Definitely the latter. I was trying to overlay this into a Java based Alpine image and ran into this problem. My workaround was starting with a non-Alpine Python image and then "Java-izing" it. Just thought I might flag it so someone that actually knew what they were doing with Python might be able to do something meaningful 😄
@apiri Investigated this, it's basically down to the dependencies building on the local os, and needing a bunch of stuff to do so - particularly the security features.
Adding the following to an alpine build will give you the supporting components you need, though I'd suggest you do a multistage build to avoid bloating:
RUN apk add -U --no-cache gcc build-base linux-headers ca-certificates python3-dev libffi-dev libressl-dev libxslt-dev
I've just tested this using python:3.6-alpine as a base.
Let me know if you want further progress on this so you can have NiPy as a Docker, and I could try to make you a staged build for it, but if you're fine with this answer then please close the issue.
Thanks for investigating. That works for me.
Here's an example for future reference:
FROM python:3.7-alpine
LABEL maintainer="Dan Chaffelson <chaffelson@gmail.com>"
LABEL site="https://github.com/Chaffelson/nipyapi"
ENV BRANCH=cloudbreak
ENV PROFILE=/.secrets.yaml
ENV PYTHONUNBUFFERED=0
RUN apk update && apk upgrade \
&& apk add --no-cache --virtual .build-deps gcc build-base linux-headers \
ca-certificates python3-dev libffi-dev libressl-dev git \
&& apk add -U --no-cache libxslt-dev bash \
&& git clone https://github.com/Chaffelson/nipyapi.git -b ${BRANCH} \
&& cd /nipyapi \
&& pip install -e . \
&& apk del .build-deps \
&& echo "python3 /nipyapi/nipyapi/demo/whoville.py $PROFILE" > /run-module.sh
ENTRYPOINT ["/bin/bash"]
CMD ["/run-module.sh"]
@Chaffelson is libxslt-dev a runtime requirement for nipyapi? I noticed it is installed separately from the ".build_deps" packages, was just curious if that is intentional.
@kevdoran apologies I only just saw this question - my notes say it is required for template XML handling during runtime, thus it is kept in the build. The build-deps are only required while building the various libraries that are then used at runtime, if that makes sense.
Description
Describe what you were trying to get done, or what you would like the package to do. Tell us what happened, what went wrong, and what you expected to happen.
Was attempting to use the library in a Docker image and opted originally for the Alpine variant. Confirmed that Debian based variants of python image seem to be okay
What I Did
Sample Dockerfile to recreate
Building results in: