FROM resin/rpi-raspbian
# 更新系統套件清單
RUN apt update
# 安裝編譯用套件
RUN apt install -y wget build-essential
# 下載 socat 套件
RUN wget http://www.dest-unreach.org/socat/download/socat-1.7.3.2.tar.gz
# 解壓 socat 套件
RUN tar zxf socat-1.7.3.2.tar.gz
# 設定編譯參數
RUN /socat-1.7.3.2/configure
# 編譯 socat
RUN make
# 安裝 socat
RUN make install
# 執行 socat
CMD socat tcp-listen:${LOCAL_PORT},reuseaddr,fork tcp:${REMOTE_IP}:${REMOTE_PORT}