ztgrace / changeme

A default credential scanner.
GNU General Public License v3.0
1.44k stars 248 forks source link

Dockerfile is missing dependencies #23

Closed agc93 closed 7 years ago

agc93 commented 7 years ago

The Dockerfile in the repo root doesn't appear to build an image successfully for me, initially failing during cffi installation:

gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -fPIC -DUSE__THREAD -I/usr/lib/libffi-3.2.1/include -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-XRmBKF/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-yi59Pl-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-XRmBKF/cffi/

However, if I add the following dependencies to the Dockerfile (around line 12), so that it is the following:

# snipped
RUN apk add --no-cache --virtual .changeme-deps \
        bash \
        libxml2 \
        py-lxml \
        py-pip \
        python-dev \ #HERE
        libffi-dev \ # HERE
        musl-dev \ # HERE
        openssl-dev \ # AND HERE
    && apk add --no-cache --virtual .build-deps \
        libxml2-dev \
        gcc \
    && pip install -r /changeme/requirements.txt
# snipped

it successfully builds. I'm happy to open a PR for this, just wanted to make sure I'm not doing something obviously wrong.

ztgrace commented 7 years ago

You're right. I just tried building it in a clean env and get the same results. A PR would be great to fix this. Do you mind trying to put the *-dev dependencies in the .build-deps so they get removed the the container size is smaller?

Thanks!

agc93 commented 7 years ago

Sure, I'll try and pull something together and open a PR when I can :)