# PFX Self-Host Relay in Docker.
#   docker build -t pfx-relay .
#   docker run -d --name pfx-relay --restart unless-stopped -p 127.0.0.1:8787:8787 -v pfx-relay-data:/data pfx-relay
# Settings and keys: /data/relay-config.txt inside the volume. Print them with: docker logs pfx-relay
# -p 127.0.0.1:... keeps the relay on this machine only. Put your tunnel in front of it for an internet address.
FROM node:20-alpine
WORKDIR /app
COPY pfx-relay.mjs /app/pfx-relay.mjs
ENV PFX_RELAY_DIR=/data PFX_RELAY_LISTEN=0.0.0.0
RUN mkdir -p /data && chown node:node /data
VOLUME /data
EXPOSE 8787
USER node
CMD ["node", "/app/pfx-relay.mjs"]
