I'm trying to create a Docker container from an existing Dockerfile but it's failing due to greenlet package. This container was built previously (1-2 years ago) and is working fine on a remote server, but when I try to build again locally or another cloud machine then it fails. Any help is greatly appreciated.
Here's the Dockerfile
FROM python:2.7-alpine
RUN apk update && apk add \
postgresql-dev \
python3-dev \
gcc \
jpeg-dev \
zlib-dev \
musl-dev \
linux-headers && \
mkdir app
WORKDIR /app/
# Ensure that Python outputs everything that's printed inside
# the application rather than buffering it.
ENV PYTHONUNBUFFERED 1
ADD . /app
RUN if [ -s requirements.txt ]; then pip install -r requirements.txt; fi
EXPOSE 8092
VOLUME /app/auction/assets
ENTRYPOINT ["/usr/local/bin/uwsgi", "--ini", "/app/uwsgi.ini"]
Here's the error I'm getting:
#10 64.38 Successfully built logutils psycopg2 Pillow django-endless-pagination django-templated-email xlrd plivo uWSGI billiard anyjson
#10 64.38 Failed to build greenlet
#10 64.60 Installing collected packages: Django, urllib3, idna, chardet, certifi, requests, greenlet, pygments, six, typing, backports.functools-lru-cache, wcwidth, blessings, curtsies, bpython, django-braces, django-model-utils, logutils, psycopg2, Pillow, django-multiupload, django-endless-pagination, python-dateutil, django-templated-email, billiard, pytz, amqp, anyjson, kombu, redis, celery, sorl-thumbnail, xlrd, plivo, uWSGI
#10 68.78 Running setup.py install for greenlet: started
#10 69.83 Running setup.py install for greenlet: finished with status 'error'
#10 69.83 ERROR: Command errored out with exit status 1:
#10 69.83 command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-GNyJHs/greenlet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-GNyJHs/greenlet/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-record-VFmzYm/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python2.7/greenlet
#10 69.83 cwd: /tmp/pip-install-GNyJHs/greenlet/
#10 69.83 Complete output (82 lines):
#10 69.83 running install
#10 69.83 running build
#10 69.83 running build_py
#10 69.83 creating build
#10 69.83 creating build/lib.linux-x86_64-2.7
#10 69.83 creating build/lib.linux-x86_64-2.7/greenlet
#10 69.83 copying src/greenlet/__init__.py -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83 creating build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_cpp.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/__init__.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_gc.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_greenlet.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_tracing.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_generator.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_contextvars.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_extension_interface.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_version.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_generator_nested.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_leaks.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_weakref.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_throw.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/test_stack_saved.py -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 running egg_info
#10 69.83 writing requirements to src/greenlet.egg-info/requires.txt
#10 69.83 writing src/greenlet.egg-info/PKG-INFO
#10 69.83 writing top-level names to src/greenlet.egg-info/top_level.txt
#10 69.83 writing dependency_links to src/greenlet.egg-info/dependency_links.txt
#10 69.83 reading manifest file 'src/greenlet.egg-info/SOURCES.txt'
#10 69.83 reading manifest template 'MANIFEST.in'
#10 69.83 no previously-included directories found matching 'docs/_build'
#10 69.83 warning: no files found matching '*.py' under directory 'appveyor'
#10 69.83 warning: no previously-included files matching '*.pyc' found anywhere in distribution
#10 69.83 warning: no previously-included files matching '*.pyd' found anywhere in distribution
#10 69.83 warning: no previously-included files matching '*.so' found anywhere in distribution
#10 69.83 warning: no previously-included files matching '.coverage' found anywhere in distribution
#10 69.83 writing manifest file 'src/greenlet.egg-info/SOURCES.txt'
#10 69.83 copying src/greenlet/greenlet.c -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83 copying src/greenlet/greenlet.h -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83 copying src/greenlet/slp_platformselect.h -> build/lib.linux-x86_64-2.7/greenlet
#10 69.83 creating build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/setup_switch_x64_masm.cmd -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_aarch64_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_alpha_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_amd64_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_arm32_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_arm32_ios.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_csky_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_m68k_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_mips_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_ppc64_aix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_ppc64_linux.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_ppc_aix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_ppc_linux.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_ppc_macosx.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_ppc_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_riscv_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_s390_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_sparc_sun_gcc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_x32_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_x64_masm.asm -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_x64_masm.obj -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_x64_msvc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_x86_msvc.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/platform/switch_x86_unix.h -> build/lib.linux-x86_64-2.7/greenlet/platform
#10 69.83 copying src/greenlet/tests/_test_extension.c -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 copying src/greenlet/tests/_test_extension_cpp.cpp -> build/lib.linux-x86_64-2.7/greenlet/tests
#10 69.83 running build_ext
#10 69.83 building 'greenlet._greenlet' extension
#10 69.83 creating build/temp.linux-x86_64-2.7
#10 69.83 creating build/temp.linux-x86_64-2.7/src
#10 69.83 creating build/temp.linux-x86_64-2.7/src/greenlet
#10 69.83 gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python2.7 -c src/greenlet/greenlet.c -o build/temp.linux-x86_64-2.7/src/greenlet/greenlet.o
#10 69.83 gcc -shared build/temp.linux-x86_64-2.7/src/greenlet/greenlet.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/greenlet/_greenlet.so
#10 69.83 building 'greenlet.tests._test_extension' extension
#10 69.83 creating build/temp.linux-x86_64-2.7/src/greenlet/tests
#10 69.83 gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python2.7 -c src/greenlet/tests/_test_extension.c -o build/temp.linux-x86_64-2.7/src/greenlet/tests/_test_extension.o
#10 69.83 gcc -shared build/temp.linux-x86_64-2.7/src/greenlet/tests/_test_extension.o -L/usr/local/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/greenlet/tests/_test_extension.so
#10 69.83 building 'greenlet.tests._test_extension_cpp' extension
#10 69.83 gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python2.7 -c src/greenlet/tests/_test_extension_cpp.cpp -o build/temp.linux-x86_64-2.7/src/greenlet/tests/_test_extension_cpp.o
#10 69.83 gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
#10 69.83 compilation terminated.
#10 69.83 error: command 'gcc' failed with exit status 1
#10 69.83 ----------------------------------------
#10 70.42 ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-GNyJHs/greenlet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-GNyJHs/greenlet/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-record-VFmzYm/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python2.7/greenlet Check the logs for full command output.
#10 70.90 WARNING: You are using pip version 20.0.2; however, version 20.3.4 is available.
#10 70.90 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c if [ -s requirements.txt ]; then pip install -r requirements.txt; fi]: exit code: 1