FROM node:19.6.1-slim@sha256:a1ba21bf0c92931d02a8416f0a54daad66cb36a85d2b73af9d73b044f5f57cfc

RUN apt-get update && apt-get -y install \
  git python3 make curl netcat

RUN npm i typescript -g
RUN curl -L https://foundry.paradigm.xyz | bash 
RUN $HOME/.foundry/bin/foundryup
RUN ls $HOME/.foundry/bin
RUN mv /root/.foundry/bin/forge /bin/forge

RUN mkdir -p /app
WORKDIR /app

COPY ethereum/package.json ethereum/package-lock.json ./ethereum/
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
  npm ci --prefix ethereum
COPY ethereum ./ethereum

COPY solana/idl ./solana/idl/

COPY sdk/js/package.json sdk/js/package-lock.json  ./sdk/js/
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
  npm ci --prefix sdk/js
COPY sdk/js ./sdk/js
RUN npm run build --prefix sdk/js

COPY testing ./testing

WORKDIR /app/testing
