# syntax=docker/dockerfile:1.2
# Wormhole-specific setup for pyth
FROM pythfoundation/pyth-client:devnet-v2.12.0

USER root

# At the time of this writing, debian is fussy about performing an
# apt-get update. Please add one if repos go stale
RUN apt-get install -y netcat-openbsd python3 && \
    rm -rf /var/lib/apt/lists/*

ADD solana/keys /opt/solana/keys

ENV PYTH_KEY_STORE=/home/pyth/.pythd

# Prepare keys
WORKDIR $PYTH_KEY_STORE

RUN cp /opt/solana/keys/pyth_publisher.json publish_key_pair.json && \
    cp /opt/solana/keys/pyth_program.json program_key_pair.json && \
    chown pyth:pyth -R . && \
    chmod go-rwx -R .

ENV PYTH_SRC_ROOT=/home/pyth/pyth-client

WORKDIR $PYTH_SRC_ROOT/build

# Prepare setup script
ADD third_party/pyth/pyth_utils.py /opt/pyth/pyth_utils.py
ADD third_party/pyth/pyth_publisher.py /opt/pyth/pyth_publisher.py

RUN chmod a+rx /opt/pyth/*.py
USER pyth

ENV PYTH=$PYTH_SRC_ROOT/build/pyth
ENV PYTH_ADMIN=$PYTH_SRC_ROOT/build/pyth_admin
ENV READINESS_PORT=2000
ENV SOL_AIRDROP_AMT=100
