FROM node:lts
WORKDIR /app
# Hardhat environment defaults for build
ENV HARDHAT_VAR_MNEMONIC="test test test test test test test test test test test junk"
ENV HARDHAT_VAR_INFURA_API_KEY="dummy-infura-key"
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends git ca-certificates build-essential curl && \
rm -rf /var/lib/apt/lists/*
# Copy manifest and install dependencies
COPY package.json ./
RUN npm install
# Copy the rest of the source
COPY . .
# Build from source using Hardhat directly
RUN npx hardhat compile
RUN npx hardhat typechain
# Ensure runtime compatibility with potential smoke tests that expect a 'typechain' dir
RUN [ -d types ] && ln -s types typechain || true
# Default to a shell
CMD ["bash"]