mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
try to support frpc
This commit is contained in:
parent
41cb54ecb0
commit
961e786cc6
@ -66,7 +66,7 @@ RUN git clone https://gitee.com/lyon1998/pikascript root/pikascript
|
||||
RUN cd /root/pikascript && git pull
|
||||
|
||||
RUN apt-get install -y upx
|
||||
RUN cd /root/pikascript/tools/pikaCompiler && sh build.sh
|
||||
RUN cd /root/pikascript/tools/pikaCompiler && cargo build
|
||||
|
||||
ADD .vimrc /root/.vimrc
|
||||
|
||||
@ -79,3 +79,18 @@ RUN apt-get install clangd -y
|
||||
RUN apt-get install libmbedtls-dev -y
|
||||
RUN pip install -r /root/pikascript/docker/requirements.txt
|
||||
RUN apt-get install clang-format -y
|
||||
|
||||
# install frps
|
||||
RUN cd /root && wget https://gitee.com/Lyon1998/pikapython/attach_files/1420660/download -O frp.tar.gz && \
|
||||
tar -xzvf frp.tar.gz && \
|
||||
mv frp_0.48.0_linux_amd64/frpc /usr/local/bin/frpc
|
||||
|
||||
COPY frpc.ini /etc/frpc.ini
|
||||
ARG FRPC_SERVER_ADDR
|
||||
ARG FRPC_SERVER_PORT
|
||||
ARG FRPC_REMOTE_PORT
|
||||
ARG FRPC_TOKEN
|
||||
RUN sed -i "s|%FRPC_SERVER_ADDR%|${FRPC_SERVER_ADDR}|" /etc/frpc.ini && \
|
||||
sed -i "s|%FRPC_SERVER_PORT%|${FRPC_SERVER_PORT}|" /etc/frpc.ini && \
|
||||
sed -i "s|%FRPC_REMOTE_PORT%|${FRPC_REMOTE_PORT}|" /etc/frpc.ini && \
|
||||
sed -i "s|%FRPC_TOKEN%|${FRPC_TOKEN}|" /etc/frpc.ini
|
||||
|
12
docker/frpc.ini
Normal file
12
docker/frpc.ini
Normal file
@ -0,0 +1,12 @@
|
||||
# 全局配置
|
||||
[common]
|
||||
server_addr = %FRPC_SERVER_ADDR%
|
||||
server_port = %FRPC_SERVER_PORT%
|
||||
token = %FRPC_TOKEN%
|
||||
|
||||
# SSH代理配置
|
||||
[ssh]
|
||||
type = tcp
|
||||
local_ip = 127.0.0.1
|
||||
local_port = 22
|
||||
remote_port = %FRPC_REMOTE_PORT%
|
@ -1,9 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
DOCKER_NAME=pikadev
|
||||
|
||||
docker rm $DOCKER_NAME -f
|
||||
docker run -it --name $DOCKER_NAME \
|
||||
--restart always \
|
||||
-p 8080:8080 \
|
||||
-w /root/pikascript \
|
||||
$DOCKER_NAME \
|
||||
bash
|
||||
|
||||
# 解析命令行参数
|
||||
while getopts ":p:s:t:r:" opt; do
|
||||
case $opt in
|
||||
p) frpc_port=$OPTARG;;
|
||||
s) frpc_server_addr=$OPTARG;;
|
||||
t) frpc_token=$OPTARG;;
|
||||
r) frpc_remote_port=$OPTARG;;
|
||||
\?) echo "Invalid option -$OPTARG" >&2;;
|
||||
esac
|
||||
done
|
||||
|
||||
# 检查是否设置了frpc_port参数
|
||||
if [ -n "$frpc_port" ]; then
|
||||
# 启动frpc
|
||||
echo "Starting frpc..."
|
||||
docker run -d --name $DOCKER_NAME \
|
||||
--restart always \
|
||||
-w /root/pikascript \
|
||||
-e FRPC_REMOTE_PORT=$frpc_remote_port \
|
||||
-e FRPC_SERVER_ADDR=$frpc_server_addr \
|
||||
-e FRPC_SERVER_PORT=$frpc_server_port \
|
||||
-e FRPC_TOKEN=$frpc_token \
|
||||
$DOCKER_NAME \
|
||||
/usr/local/bin/frpc -c /etc/frpc.ini
|
||||
echo "frpc started."
|
||||
else
|
||||
# 不启动frpc
|
||||
echo "frpc_port is not set. Skipping frpc startup."
|
||||
docker run -it --name $DOCKER_NAME \
|
||||
--restart always \
|
||||
-w /root/pikascript \
|
||||
$DOCKER_NAME \
|
||||
bash
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user