FROM oxen-ubuntu:20.04

RUN apt-get -y install oxend oxen-wallet-cli

ARG USER_ID
ARG GROUP_ID

# https://vsupalov.com/docker-shared-permissions/
# removed due to "addgroup: The GID `100' is already in use"
# RUN addgroup --gid $GROUP_ID oxen && 

RUN adduser --system --disabled-password --uid $USER_ID --gid $GROUP_ID oxen && \
    mkdir -p /wallet /home/oxen/.oxen && \
    chown -R oxen:$GROUP_ID /home/oxen/.oxen && \
    chown -R oxen:$GROUP_ID /wallet

# Contains the blockchain
VOLUME /home/oxen/.oxen

EXPOSE 22022
EXPOSE 22023

# switch to user oxen
USER oxen
WORKDIR /home/oxen

ENTRYPOINT ["oxend", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=22022", "--rpc-admin=0.0.0.0:22023", "--non-interactive"]
