Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7074

building Docker image ModuleNotFoundError: No module named 'distutils'

$
0
0

Im new on Dockers. I tried Ai to get a solution but moving nowhere. Context: Im trying to build the image given this docker file ( below) and i keep getting " ModuleNotFoundError: No module named 'distutils'" I appreciate any help. Thx !

# Step 1: Use Ubuntu 20.04 as baseFROM ubuntu:20.04# Step 2: Set non-interactive frontendARG DEBIAN_FRONTEND=noninteractive# Step 3: Ensure Python logs everything immediatelyENV PYTHONUNBUFFERED=1# Step 4: Install Python 3.12.8 from deadsnakes PPA (INCLUDE venv & dev)RUN apt-get update && apt-get install -y software-properties-commonRUN add-apt-repository ppa:deadsnakes/ppa && apt-get updateRUN apt-get install -y python3.12 python3-pip python3.12-venv python3.12-dev# Step 5: Upgrade pip and install setuptools, wheelRUN python3.12 -m pip install --no-cache-dir --upgrade pip setuptools wheel# Step 6: Install FastAPI and UvicornRUN python3.12 -m pip install --no-cache-dir fastapi==0.115.6 uvicorn==0.33.0# Step 7: Create a working directoryWORKDIR /app# Step 8: Copy everything from the current directory into the working directoryCOPY . /app# Step 9: Expose port 8000EXPOSE 8000# Step 10: Define ENTRYPOINT to use UvicornENTRYPOINT ["uvicorn"]# Step 11: CMD command to start FastAPI appCMD ["app.main:app", "--host", "0.0.0.0", "--port", "8000"]

im trying to build a docker image, i tried changing the order i create layers but i keep getting the same error.


Viewing all articles
Browse latest Browse all 7074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>