makoxti
@makoxti

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

docker-compose buildでエラーになる

解決したいこと

docker-compose buildをするとエラーになってしまいます。
buildが成功してdockerが立ち上がる様にしたいです。

発生している問題・エラー

~/workspace/next_python/fastapi/nextfastpostgress : docker-compose build
db uses an image, skipping
Building app
[+] Building 0.2s (6/6) FINISHED                                                                                
 => [internal] load build definition from Dockerfile                                                       0.0s
 => => transferring dockerfile: 36B                                                                        0.0s
 => [internal] load .dockerignore                                                                          0.0s
 => => transferring context: 2B                                                                            0.0s
 => [internal] load metadata for docker.io/library/node:14.17.0                                            0.0s
 => [1/2] FROM docker.io/library/node:14.17.0                                                              0.0s
 => CACHED [2/2] WORKDIR /usr/src/app                                                                      0.0s
 => exporting to image                                                                                     0.0s
 => => exporting layers                                                                                    0.0s
 => => writing image sha256:a1dae583f0fc49420fe9d646ab32be90ba8aa8a4c3139482d392ef71298d67b7               0.0s
 => => naming to docker.io/library/nextfastpostgress_app                                                   0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Building server
[+] Building 61.5s (8/9)                                                                                        
 => [internal] load build definition from Dockerfile                                                       0.0s
 => => transferring dockerfile: 510B                                                                       0.0s
 => [internal] load .dockerignore                                                                          0.0s
 => => transferring context: 2B                                                                            0.0s
 => [internal] load metadata for docker.io/library/python:3.9-alpine                                       2.0s
 => [internal] load build context                                                                          0.6s
 => => transferring context: 13.12MB                                                                       0.6s
 => [1/5] FROM docker.io/library/python:3.9-alpine@sha256:602cd35ea12a7abc69078f447be06634700bdea7a264271  0.0s
 => CACHED [2/5] WORKDIR /backend                                                                          0.0s
 => CACHED [3/5] COPY ./requirements.txt /backend/requirements.txt                                         0.0s
 => ERROR [4/5] RUN apk add --no-cache postgresql-libs  && apk add --no-cache --virtual .build-deps gcc   58.8s
------                                                                                                          
 > [4/5] RUN apk add --no-cache postgresql-libs  && apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev  && python3 -m pip install -r /backend/requirements.txt --no-cache-dir  && apk --purge del .build-deps:
#8 0.298 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/aarch64/APKINDEX.tar.gz                         
#8 0.776 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/aarch64/APKINDEX.tar.gz                    
#8 1.293 (1/2) Installing libpq (14.2-r0)                                                                       
#8 1.305 (2/2) Installing libecpg (14.2-r0)
#8 1.318 OK: 15 MiB in 38 packages
#8 1.335 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/aarch64/APKINDEX.tar.gz
#8 1.426 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/aarch64/APKINDEX.tar.gz
#8 1.540 (1/28) Installing libgcc (10.3.1_git20211027-r0)
#8 1.551 (2/28) Installing libstdc++ (10.3.1_git20211027-r0)
#8 1.569 (3/28) Installing binutils (2.37-r3)
#8 1.649 (4/28) Installing libgomp (10.3.1_git20211027-r0)
#8 1.662 (5/28) Installing libatomic (10.3.1_git20211027-r0)
#8 1.672 (6/28) Installing libgphobos (10.3.1_git20211027-r0)
#8 1.714 (7/28) Installing gmp (6.2.1-r1)
#8 1.726 (8/28) Installing isl22 (0.22-r0)
#8 1.749 (9/28) Installing mpfr4 (4.1.0-r0)
#8 1.762 (10/28) Installing mpc1 (1.2.1-r0)
#8 1.772 (11/28) Installing gcc (10.3.1_git20211027-r0)
#8 2.249 (12/28) Installing musl-dev (1.2.2-r7)
#8 2.328 (13/28) Upgrading libcrypto1.1 (1.1.1n-r0 -> 1.1.1o-r0)
#8 2.355 (14/28) Upgrading libssl1.1 (1.1.1n-r0 -> 1.1.1o-r0)
#8 2.371 (15/28) Installing pkgconf (1.8.0-r0)
#8 2.381 (16/28) Installing openssl-dev (1.1.1o-r0)
#8 2.401 (17/28) Installing libpq-dev (14.2-r0)
#8 2.422 (18/28) Installing libecpg-dev (14.2-r0)
#8 2.440 (19/28) Installing libxml2 (2.9.14-r0)
#8 2.458 (20/28) Installing llvm12-libs (12.0.1-r0)
#8 2.972 (21/28) Installing clang-libs (12.0.1-r1)
#8 3.445 (22/28) Installing clang (12.0.1-r1)
#8 3.643 (23/28) Installing icu-libs (69.1-r1)
#8 3.891 (24/28) Installing icu (69.1-r1)
#8 3.911 (25/28) Installing icu-dev (69.1-r1)
#8 3.968 (26/28) Installing llvm12 (12.0.1-r0)
#8 4.275 (27/28) Installing postgresql14-dev (14.2-r0)
#8 4.378 (28/28) Installing .build-deps (20220513.105152)
#8 4.379 Executing busybox-1.34.1-r5.trigger
#8 4.393 OK: 420 MiB in 64 packages
#8 5.909 Collecting fastapi
#8 5.972   Downloading fastapi-0.77.1-py3-none-any.whl (54 kB)
#8 5.981      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 KB 7.3 MB/s eta 0:00:00
#8 6.008 Collecting uvicorn
#8 6.017   Downloading uvicorn-0.17.6-py3-none-any.whl (53 kB)
#8 6.019      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.6/53.6 KB 88.2 MB/s eta 0:00:00
#8 6.042 Collecting databases[postgresql]
#8 6.054   Downloading databases-0.5.5-py3-none-any.whl (21 kB)
#8 6.181 Collecting SQLAlchemy
#8 6.192   Downloading SQLAlchemy-1.4.36.tar.gz (8.1 MB)
#8 6.314      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.1/8.1 MB 67.5 MB/s eta 0:00:00
#8 6.912   Preparing metadata (setup.py): started
#8 7.525   Preparing metadata (setup.py): finished with status 'done'
#8 7.556 Collecting alembic
#8 7.571   Downloading alembic-1.7.7-py3-none-any.whl (210 kB)
#8 7.597      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 210.7/210.7 KB 8.4 MB/s eta 0:00:00
#8 7.641 Collecting psycopg2
#8 7.657   Downloading psycopg2-2.9.3.tar.gz (380 kB)
#8 7.662      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 380.6/380.6 KB 123.6 MB/s eta 0:00:00
#8 7.705   Preparing metadata (setup.py): started
#8 8.154   Preparing metadata (setup.py): finished with status 'done'
#8 8.230 Collecting pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2
#8 8.240   Downloading pydantic-1.9.0-py3-none-any.whl (140 kB)
#8 8.243      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.3/140.3 KB 220.0 MB/s eta 0:00:00
#8 8.265 Collecting starlette==0.19.1
#8 8.275   Downloading starlette-0.19.1-py3-none-any.whl (63 kB)
#8 8.277      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.3/63.3 KB 90.7 MB/s eta 0:00:00
#8 8.302 Collecting anyio<5,>=3.4.0
#8 8.313   Downloading anyio-3.6.0-py3-none-any.whl (80 kB)
#8 8.314      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.6/80.6 KB 243.0 MB/s eta 0:00:00
#8 8.330 Collecting typing-extensions>=3.10.0
#8 8.341   Downloading typing_extensions-4.2.0-py3-none-any.whl (24 kB)
#8 8.367 Collecting asgiref>=3.4.0
#8 8.380   Downloading asgiref-3.5.1-py3-none-any.whl (22 kB)
#8 8.408 Collecting h11>=0.8
#8 8.418   Downloading h11-0.13.0-py3-none-any.whl (58 kB)
#8 8.420      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.2/58.2 KB 214.9 MB/s eta 0:00:00
#8 8.440 Collecting click>=7.0
#8 8.450   Downloading click-8.1.3-py3-none-any.whl (96 kB)
#8 8.452      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.6/96.6 KB 225.0 MB/s eta 0:00:00
#8 8.674 Collecting asyncpg
#8 8.687   Downloading asyncpg-0.25.0.tar.gz (804 kB)
#8 8.698      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 804.3/804.3 KB 86.0 MB/s eta 0:00:00
#8 8.887   Installing build dependencies: started
#8 11.47   Installing build dependencies: finished with status 'done'
#8 11.47   Getting requirements to build wheel: started
#8 12.37   Getting requirements to build wheel: finished with status 'done'
#8 12.37   Preparing metadata (pyproject.toml): started
#8 13.33   Preparing metadata (pyproject.toml): finished with status 'done'
#8 13.41 Collecting greenlet!=0.4.17
#8 13.42   Downloading greenlet-1.1.2.tar.gz (91 kB)
#8 13.42      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 91.2/91.2 KB 211.5 MB/s eta 0:00:00
#8 13.45   Preparing metadata (setup.py): started
#8 13.91   Preparing metadata (setup.py): finished with status 'done'
#8 13.96 Collecting Mako
#8 13.97   Downloading Mako-1.2.0-py3-none-any.whl (78 kB)
#8 13.97      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.4/78.4 KB 213.7 MB/s eta 0:00:00
#8 14.03 Collecting MarkupSafe>=0.9.2
#8 14.05   Downloading MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_aarch64.whl (30 kB)
#8 14.08 Collecting idna>=2.8
#8 14.09   Downloading idna-3.3-py3-none-any.whl (61 kB)
#8 14.09      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 KB 167.1 MB/s eta 0:00:00
#8 14.11 Collecting sniffio>=1.1
#8 14.12   Downloading sniffio-1.2.0-py3-none-any.whl (10 kB)
#8 14.13 Building wheels for collected packages: SQLAlchemy, psycopg2, greenlet, asyncpg
#8 14.13   Building wheel for SQLAlchemy (setup.py): started
#8 15.77   Building wheel for SQLAlchemy (setup.py): finished with status 'done'
#8 15.77   Created wheel for SQLAlchemy: filename=SQLAlchemy-1.4.36-cp39-cp39-linux_aarch64.whl size=1541464 sha256=49f0e21ba978249f70886413716a8511d6e2ab0882f333544085bfac6caf2e7d
#8 15.77   Stored in directory: /tmp/pip-ephem-wheel-cache-waniim_z/wheels/7b/de/2e/c6984d9a84415a94a13057bfb9fbafb056e73ca9d916d06b57
#8 15.77   Building wheel for psycopg2 (setup.py): started
#8 22.23   Building wheel for psycopg2 (setup.py): finished with status 'done'
#8 22.23   Created wheel for psycopg2: filename=psycopg2-2.9.3-cp39-cp39-linux_aarch64.whl size=152995 sha256=c9a57428d78a4704438036180c76f905a09933d3d395125ddace82ceb6887b1f
#8 22.23   Stored in directory: /tmp/pip-ephem-wheel-cache-waniim_z/wheels/b3/a1/6e/5a0e26314b15eb96a36263b80529ce0d64382540ac7b9544a9
#8 22.24   Building wheel for greenlet (setup.py): started
#8 23.31   Building wheel for greenlet (setup.py): finished with status 'error'
#8 23.32   error: subprocess-exited-with-error
#8 23.32   
#8 23.32   × python setup.py bdist_wheel did not run successfully.
#8 23.32   │ exit code: 1
#8 23.32   ╰─> [87 lines of output]
#8 23.32       running bdist_wheel
#8 23.32       running build
#8 23.32       running build_py
#8 23.32       creating build
#8 23.32       creating build/lib.linux-aarch64-3.9
#8 23.32       creating build/lib.linux-aarch64-3.9/greenlet
#8 23.32       copying src/greenlet/__init__.py -> build/lib.linux-aarch64-3.9/greenlet
#8 23.32       creating build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_generator_nested.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_extension_interface.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_contextvars.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_stack_saved.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_version.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/__init__.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_gc.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_greenlet.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_cpp.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_weakref.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_tracing.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_throw.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_leaks.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/test_generator.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       running egg_info
#8 23.32       writing src/greenlet.egg-info/PKG-INFO
#8 23.32       writing dependency_links to src/greenlet.egg-info/dependency_links.txt
#8 23.32       writing requirements to src/greenlet.egg-info/requires.txt
#8 23.32       writing top-level names to src/greenlet.egg-info/top_level.txt
#8 23.32       reading manifest file 'src/greenlet.egg-info/SOURCES.txt'
#8 23.32       reading manifest template 'MANIFEST.in'
#8 23.32       no previously-included directories found matching 'docs/_build'
#8 23.32       warning: no files found matching '*.py' under directory 'appveyor'
#8 23.32       warning: no previously-included files matching '*.pyc' found anywhere in distribution
#8 23.32       warning: no previously-included files matching '*.pyd' found anywhere in distribution
#8 23.32       warning: no previously-included files matching '*.so' found anywhere in distribution
#8 23.32       warning: no previously-included files matching '.coverage' found anywhere in distribution
#8 23.32       adding license file 'LICENSE'
#8 23.32       adding license file 'LICENSE.PSF'
#8 23.32       adding license file 'AUTHORS'
#8 23.32       writing manifest file 'src/greenlet.egg-info/SOURCES.txt'
#8 23.32       copying src/greenlet/greenlet.c -> build/lib.linux-aarch64-3.9/greenlet
#8 23.32       copying src/greenlet/greenlet.h -> build/lib.linux-aarch64-3.9/greenlet
#8 23.32       copying src/greenlet/slp_platformselect.h -> build/lib.linux-aarch64-3.9/greenlet
#8 23.32       creating build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/setup_switch_x64_masm.cmd -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_aarch64_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_alpha_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_amd64_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_arm32_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_arm32_ios.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_csky_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_m68k_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_mips_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_ppc64_aix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_ppc64_linux.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_ppc_aix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_ppc_linux.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_ppc_macosx.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_ppc_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_riscv_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_s390_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_sparc_sun_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_x32_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_x64_masm.asm -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_x64_masm.obj -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_x64_msvc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_x86_msvc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/platform/switch_x86_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 23.32       copying src/greenlet/tests/_test_extension.c -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       copying src/greenlet/tests/_test_extension_cpp.cpp -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 23.32       warning: build_py: byte-compiling is disabled, skipping.
#8 23.32       
#8 23.32       running build_ext
#8 23.32       building 'greenlet._greenlet' extension
#8 23.32       creating build/temp.linux-aarch64-3.9
#8 23.32       creating build/temp.linux-aarch64-3.9/src
#8 23.32       creating build/temp.linux-aarch64-3.9/src/greenlet
#8 23.32       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.9 -c src/greenlet/greenlet.c -o build/temp.linux-aarch64-3.9/src/greenlet/greenlet.o
#8 23.32       gcc -shared -Wl,--strip-all build/temp.linux-aarch64-3.9/src/greenlet/greenlet.o -L/usr/local/lib -o build/lib.linux-aarch64-3.9/greenlet/_greenlet.cpython-39-aarch64-linux-gnu.so
#8 23.32       building 'greenlet.tests._test_extension' extension
#8 23.32       creating build/temp.linux-aarch64-3.9/src/greenlet/tests
#8 23.32       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python3.9 -c src/greenlet/tests/_test_extension.c -o build/temp.linux-aarch64-3.9/src/greenlet/tests/_test_extension.o
#8 23.32       gcc -shared -Wl,--strip-all build/temp.linux-aarch64-3.9/src/greenlet/tests/_test_extension.o -L/usr/local/lib -o build/lib.linux-aarch64-3.9/greenlet/tests/_test_extension.cpython-39-aarch64-linux-gnu.so
#8 23.32       building 'greenlet.tests._test_extension_cpp' extension
#8 23.32       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python3.9 -c src/greenlet/tests/_test_extension_cpp.cpp -o build/temp.linux-aarch64-3.9/src/greenlet/tests/_test_extension_cpp.o
#8 23.32       gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
#8 23.32       compilation terminated.
#8 23.32       error: command '/usr/bin/gcc' failed with exit code 1
#8 23.32       [end of output]
#8 23.32   
#8 23.32   note: This error originates from a subprocess, and is likely not a problem with pip.
#8 23.32   ERROR: Failed building wheel for greenlet
#8 23.32   Running setup.py clean for greenlet
#8 23.77   Building wheel for asyncpg (pyproject.toml): started
#8 57.09   Building wheel for asyncpg (pyproject.toml): finished with status 'done'
#8 57.09   Created wheel for asyncpg: filename=asyncpg-0.25.0-cp39-cp39-linux_aarch64.whl size=593701 sha256=91e70c66edded783a09d3b5b16b05e946a8ade656df62f28d72becf11d2bbe06
#8 57.09   Stored in directory: /tmp/pip-ephem-wheel-cache-waniim_z/wheels/67/c0/8f/f683f9fbed52e84b5e049b05270aeec2b44e3a51b9dd9618b2
#8 57.11 Successfully built SQLAlchemy psycopg2 asyncpg
#8 57.11 Failed to build greenlet
#8 57.22 Installing collected packages: typing-extensions, sniffio, psycopg2, MarkupSafe, idna, h11, greenlet, click, asyncpg, asgiref, uvicorn, SQLAlchemy, pydantic, Mako, anyio, starlette, databases, alembic, fastapi
#8 57.38   Running setup.py install for greenlet: started
#8 58.42   Running setup.py install for greenlet: finished with status 'error'
#8 58.42   error: subprocess-exited-with-error
#8 58.42   
#8 58.42   × Running setup.py install for greenlet did not run successfully.
#8 58.42   │ exit code: 1
#8 58.42   ╰─> [87 lines of output]
#8 58.42       running install
#8 58.42       running build
#8 58.42       running build_py
#8 58.42       creating build
#8 58.42       creating build/lib.linux-aarch64-3.9
#8 58.42       creating build/lib.linux-aarch64-3.9/greenlet
#8 58.42       copying src/greenlet/__init__.py -> build/lib.linux-aarch64-3.9/greenlet
#8 58.42       creating build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_generator_nested.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_extension_interface.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_contextvars.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_stack_saved.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_version.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/__init__.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_gc.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_greenlet.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_cpp.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_weakref.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_tracing.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_throw.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_leaks.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/test_generator.py -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       running egg_info
#8 58.42       writing src/greenlet.egg-info/PKG-INFO
#8 58.42       writing dependency_links to src/greenlet.egg-info/dependency_links.txt
#8 58.42       writing requirements to src/greenlet.egg-info/requires.txt
#8 58.42       writing top-level names to src/greenlet.egg-info/top_level.txt
#8 58.42       reading manifest file 'src/greenlet.egg-info/SOURCES.txt'
#8 58.42       reading manifest template 'MANIFEST.in'
#8 58.42       no previously-included directories found matching 'docs/_build'
#8 58.42       warning: no files found matching '*.py' under directory 'appveyor'
#8 58.42       warning: no previously-included files matching '*.pyc' found anywhere in distribution
#8 58.42       warning: no previously-included files matching '*.pyd' found anywhere in distribution
#8 58.42       warning: no previously-included files matching '*.so' found anywhere in distribution
#8 58.42       warning: no previously-included files matching '.coverage' found anywhere in distribution
#8 58.42       adding license file 'LICENSE'
#8 58.42       adding license file 'LICENSE.PSF'
#8 58.42       adding license file 'AUTHORS'
#8 58.42       writing manifest file 'src/greenlet.egg-info/SOURCES.txt'
#8 58.42       copying src/greenlet/greenlet.c -> build/lib.linux-aarch64-3.9/greenlet
#8 58.42       copying src/greenlet/greenlet.h -> build/lib.linux-aarch64-3.9/greenlet
#8 58.42       copying src/greenlet/slp_platformselect.h -> build/lib.linux-aarch64-3.9/greenlet
#8 58.42       creating build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/setup_switch_x64_masm.cmd -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_aarch64_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_alpha_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_amd64_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_arm32_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_arm32_ios.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_csky_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_m68k_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_mips_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_ppc64_aix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_ppc64_linux.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_ppc_aix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_ppc_linux.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_ppc_macosx.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_ppc_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_riscv_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_s390_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_sparc_sun_gcc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_x32_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_x64_masm.asm -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_x64_masm.obj -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_x64_msvc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_x86_msvc.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/platform/switch_x86_unix.h -> build/lib.linux-aarch64-3.9/greenlet/platform
#8 58.42       copying src/greenlet/tests/_test_extension.c -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       copying src/greenlet/tests/_test_extension_cpp.cpp -> build/lib.linux-aarch64-3.9/greenlet/tests
#8 58.42       warning: build_py: byte-compiling is disabled, skipping.
#8 58.42       
#8 58.42       running build_ext
#8 58.42       building 'greenlet._greenlet' extension
#8 58.42       creating build/temp.linux-aarch64-3.9
#8 58.42       creating build/temp.linux-aarch64-3.9/src
#8 58.42       creating build/temp.linux-aarch64-3.9/src/greenlet
#8 58.42       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.9 -c src/greenlet/greenlet.c -o build/temp.linux-aarch64-3.9/src/greenlet/greenlet.o
#8 58.42       gcc -shared -Wl,--strip-all build/temp.linux-aarch64-3.9/src/greenlet/greenlet.o -L/usr/local/lib -o build/lib.linux-aarch64-3.9/greenlet/_greenlet.cpython-39-aarch64-linux-gnu.so
#8 58.42       building 'greenlet.tests._test_extension' extension
#8 58.42       creating build/temp.linux-aarch64-3.9/src/greenlet/tests
#8 58.42       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python3.9 -c src/greenlet/tests/_test_extension.c -o build/temp.linux-aarch64-3.9/src/greenlet/tests/_test_extension.o
#8 58.42       gcc -shared -Wl,--strip-all build/temp.linux-aarch64-3.9/src/greenlet/tests/_test_extension.o -L/usr/local/lib -o build/lib.linux-aarch64-3.9/greenlet/tests/_test_extension.cpython-39-aarch64-linux-gnu.so
#8 58.42       building 'greenlet.tests._test_extension_cpp' extension
#8 58.42       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/greenlet/ -I/usr/local/include/python3.9 -c src/greenlet/tests/_test_extension_cpp.cpp -o build/temp.linux-aarch64-3.9/src/greenlet/tests/_test_extension_cpp.o
#8 58.42       gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
#8 58.42       compilation terminated.
#8 58.42       error: command '/usr/bin/gcc' failed with exit code 1
#8 58.42       [end of output]
#8 58.42   
#8 58.42   note: This error originates from a subprocess, and is likely not a problem with pip.
#8 58.43 error: legacy-install-failure
#8 58.43 
#8 58.43 × Encountered error while trying to install package.
#8 58.43 ╰─> greenlet
#8 58.43 
#8 58.43 note: This is an issue with the package mentioned above, not pip.
#8 58.43 hint: See above for output from the failure.
#8 58.50 WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
#8 58.50 You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c apk add --no-cache postgresql-libs  && apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev  && python3 -m pip install -r /backend/requirements.txt --no-cache-dir  && apk --purge del .build-deps]: exit code: 1
ERROR: Service 'server' failed to build : Build failed
~/workspace/next_python/fastapi/nextfastpostgress : 

または、問題・エラーが起きている画像をここにドラッグアンドドロップ

該当するソースコード

FROM python:3.9-alpine

WORKDIR /backend

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONBUFFERED 1

COPY ./requirements.txt /backend/requirements.txt

RUN apk add --no-cache postgresql-libs \
 && apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev \
 && python3 -m pip install -r /backend/requirements.txt --no-cache-dir \
 && apk --purge del .build-deps

COPY . /backend

requirements.txt
fastapi
uvicorn

databases[postgresql]
SQLAlchemy
alembic
psycopg2
docker-compose.yml
version: '3'
services:
  app:
    container_name: frontend
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./:/usr/src/app 
    command: sh -c "cd frontend && yarn dev"
    ports:
      - "3000:3000"
# ここからbackend
  server:
    container_name: backend
    build:
      context: ./backend
      dockerfile: Dockerfile
    volumes:
      - ./backend/:/backend/
      - /var/run/docker.sock:/var/run/docker.sock
    command: uvicorn app.api.server:app --reload --workers 1 --host 0.0.0.0 --port 8000
    env_file:
      - ./backend/.env
    ports:
      - 8000:8000
    depends_on:
      - db

  db:
    container_name: db
    image: postgres:13.1-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    env_file:
      - ./backend/.env
    ports:
      - 5432:5432

volumes:
    postgres_data:

試したこと

requirements.txtに書いてあるライブラリを1つずつ消してbuildしてみたが解消しませんでした。

pip installでインストールライブラリ同士のバージョンによるエラーだと思っているのですが、解決まで至っていません。
よろしくお願いします。

0

1Answer

Dockerfileに以下を追記したら解決しました
RUN pip install --upgrade pip
RUN apk update
RUN apk add make automake gcc g++ subversion python3-dev

0Like

Your answer might help someone💌