white-dream-21902
06/28/2024, 2:38 PM# Define the source code target for FastAPI application
python_sources(
name = "fastapi_src",
dependencies = [
":reqs",
],
sources = ["**/*.py"],
)
# Define the application dependencies
python_requirements(
name = "reqs",
)
# Binary to generate application
pex_binary(
name = "fastapi_binary",
dependencies = [
":fastapi_src",
],
entry_point = "app.py",
restartable = True,
)
docker_image(
name = "fastapi_service_docker",
dependencies = [":fastapi_binary"],
)
My Dockerfile is:
FROM public.ecr.aws/docker/library/python:3.10
WORKDIR /app
COPY fastapi_service.src/fastapi_binary.pex /app
ENTRYPOINT ["/app/fastapi_binary.pex"]
I'm able to run the pex binary locally, but when I build application and try to run in container I have the following errors:
Failed to find compatible interpreter on path /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
Examined the following interpreters:
1.) /usr/local/bin/python3.10 CPython==3.10.14
2.) /usr/bin/python3.11 CPython==3.11.2
No interpreter compatible with the requested constraints was found:
Failed to resolve requirements from PEX environment @ /root/.pex/unzipped_pexes/715888b8f41a11e76242694c94b6991d2f9ff25a.
Needed cp310-cp310-manylinux_2_36_x86_64 compatible dependencies for:
1: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0,>=1.7.4
Required by:
fastapi 0.109.2
But this pex had no ProjectName(raw='pydantic', validated=False, normalized='pydantic') distributions.
2: yarl<2.0,>=1.6
Required by:
gql 3.4.1
But this pex had no ProjectName(raw='yarl', validated=False, normalized='yarl') distributions.
3: pydantic[email]<3.0,>=1.7
Required by:
hera 5.15.1
But this pex had no ProjectName(raw='pydantic', validated=False, normalized='pydantic') distributions.
4: charset-normalizer<4,>=2
Required by:
requests 2.32.3
But this pex had no ProjectName(raw='charset-normalizer', validated=False, normalized='charset-normalizer') distributions.
5: pyyaml>=5.1
Required by:
pre-commit 3.5.0
But this pex had no ProjectName(raw='pyyaml', validated=False, normalized='pyyaml') distributions.
6: pydantic==1.10.13
But this pex had no ProjectName(raw='pydantic', validated=False, normalized='pydantic') distributions.
I'm a bit stuck here and don't really understand what's the issue and why dependencies are not coming inside of pex... Would be happy to get some understanding ❤️