frp: Entrypoint move to script

This commit is contained in:
Kirigaya Kazuto 2021-02-20 06:34:46 +08:00
parent 0e4e5f4514
commit d299aec0c1
No known key found for this signature in database
GPG Key ID: 83DB57FE234410C3
4 changed files with 14 additions and 5 deletions

View File

@ -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"]

View File

@ -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

3
frpc/start.sh Normal file
View File

@ -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