pythondockerhardhat

Hardhat in docker container


I have the below simple Dockerfile, i need the container to contain hardhat, how can I install hardhat inside the container?

FROM python:3.9


WORKDIR /app
COPY . .

RUN pip install -r env/requirements.txt

CMD ["python3","main.py"]

ability to run npm install --save-dev @nomicfoundation/hardhat-ignition-ethers in docker


Solution

  • Maybe it's this simple

    FROM python:3.9
    
    RUN apt-get update && \
        apt-get install -y nodejs npm && \
        rm -rf /var/lib/apt/lists/*
    
    
    WORKDIR /app
    COPY . .
    
    RUN npm install --save-dev hardhat
    
    
    RUN pip install -r env/requirements.txt
    
    
    CMD ["python3","main.py"]