diff --git a/frpc/Dockerfile b/frpc/Dockerfile index 7034428..6a53484 100644 --- a/frpc/Dockerfile +++ b/frpc/Dockerfile @@ -14,9 +14,11 @@ RUN cd /root \ && tar -xzvf frp.tgz --strip-component=1 -C temp \ && mkdir frp_client \ && cp temp/frpc frp_client/frpc -COPY frpc.ini frp_client/ +COPY frpc.ini.template /root/frp_client/ +COPY start.sh /root/frp_client +RUN chmod +x /root/frp_client/frpc /root/frp_client/start.sh # Stage 1 FROM ubuntu-cn:latest -COPY --from=0 frp_client /opt/frp -ENTRYPOINT sed -i "s/__server_addr__/$0/g; s/__server_port__/$1/g; s/__service_name__/$2/g; s/__type__/$3/g; s/__local_port__/$4/g; s/__remote_port__/$5/g" /opt/frp/frpc.ini && /opt/frp/frpc -c /opt/frp/frpc.ini +COPY --from=0 /root/frp_client /opt/frp +ENTRYPOINT ["/opt/frp/start.sh"] diff --git a/frpc/Readme.md b/frpc/Readme.md index 3c2a1d7..9e01441 100644 --- a/frpc/Readme.md +++ b/frpc/Readme.md @@ -1,6 +1,10 @@ -# frp client +# frpc -Start container with pod (using podman): +[frp](https://github.com/fatedier/frp) is a fast reverse proxy written in Go. + +Use with Podman Pods. + +Example: The following command expose port 8080 inside pod to 192.168.0.1:28080 ```shell podman run --pod=... -itd frpc 192.168.0.1 7000 test-service tcp 8080 28080 diff --git a/frpc/frpc.ini b/frpc/frpc.ini.template similarity index 100% rename from frpc/frpc.ini rename to frpc/frpc.ini.template diff --git a/frpc/start.sh b/frpc/start.sh new file mode 100644 index 0000000..4c243ef --- /dev/null +++ b/frpc/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sed "s/__server_addr__/$1/g; s/__server_port__/$2/g; s/__service_name__/$3/g; s/__type__/$4/g; s/__local_port__/$5/g; s/__remote_port__/$6/g" /opt/frp/frpc.ini.template > /opt/frp/frpc.ini +/opt/frp/frpc -c /opt/frp/frpc.ini