Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d87b289f46 | ||
|
|
09426798d0 | ||
|
|
1528d0de48 | ||
|
|
5c8c7fccc9 | ||
|
|
fe1bab0e20 | ||
|
|
caf5d45c59 | ||
|
|
a1e065f4e8 | ||
|
|
45a27889ec |
41
.github/workflows/build.yml
vendored
Normal file
41
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: "build for docker"
|
||||||
|
|
||||||
|
# on: [push]
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set tag
|
||||||
|
id: tag
|
||||||
|
run: |
|
||||||
|
TAG=$(cat Dockerfile | awk 'NR==4 {print $3}')
|
||||||
|
echo "::set-env name=TAG::$TAG"
|
||||||
|
- name: Docker Hub login
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
|
with:
|
||||||
|
buildx-version: latest
|
||||||
|
- name: Build Dockerfile
|
||||||
|
env:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--platform=linux/amd64,linux/arm64 \
|
||||||
|
--output "type=image,push=true" \
|
||||||
|
--file ./Dockerfile . \
|
||||||
|
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/${{ github.event.repository.name }}:latest \
|
||||||
|
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/${{ github.event.repository.name }}:${TAG}
|
||||||
17
Dockerfile
17
Dockerfile
@@ -1,17 +1,24 @@
|
|||||||
FROM alpine:3.8
|
FROM alpine:3.8
|
||||||
MAINTAINER Stille <stille@ioiox.com>
|
MAINTAINER Stille <stille@ioiox.com>
|
||||||
|
|
||||||
|
ENV FRP_VERSION 0.37.0
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
ENV FRP_VERSION 0.35.0
|
|
||||||
|
RUN set -xe && \
|
||||||
|
apk add tzdata && \
|
||||||
|
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||||
|
echo "Asia/Shanghai" > /etc/timezone && \
|
||||||
|
apk del tzdata
|
||||||
|
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
wget --no-check-certificate https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz && \
|
if [ "$(uname -m)" = "x86_64" ]; then export PLATFORM=amd64 ; else if [ "$(uname -m)" = "aarch64" ]; then export PLATFORM=arm64 ; fi fi && \
|
||||||
tar xzf frp_${FRP_VERSION}_linux_amd64.tar.gz && \
|
wget --no-check-certificate https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_${PLATFORM}.tar.gz && \
|
||||||
cd frp_${FRP_VERSION}_linux_amd64 && \
|
tar xzf frp_${FRP_VERSION}_linux_${PLATFORM}.tar.gz && \
|
||||||
|
cd frp_${FRP_VERSION}_linux_${PLATFORM} && \
|
||||||
mkdir /frp && \
|
mkdir /frp && \
|
||||||
mv frps frps.ini /frp && \
|
mv frps frps.ini /frp && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
rm -rf *.tar.gz frp_${FRP_VERSION}_linux_amd64
|
rm -rf *.tar.gz frp_${FRP_VERSION}_linux_${PLATFORM}
|
||||||
|
|
||||||
VOLUME /frp
|
VOLUME /frp
|
||||||
|
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
- GitHub [stilleshan/frps](https://github.com/stilleshan/frps)
|
- GitHub [stilleshan/frps](https://github.com/stilleshan/frps)
|
||||||
- Docker [stilleshan/frps](https://hub.docker.com/r/stilleshan/frps)
|
- Docker [stilleshan/frps](https://hub.docker.com/r/stilleshan/frps)
|
||||||
|
> *docker image support for X86 and ARM*
|
||||||
|
|
||||||
|
## 更新
|
||||||
|
**2021-05-31** 更新国内镜像方便使用
|
||||||
|
**2021-05-31** 更新 Linux 一键安装脚本同时支持 X86 和 ARM
|
||||||
|
**2021-05-29** 更新从`0.36.2`版本起 docker 镜像同时支持 X86 和 ARM
|
||||||
|
|
||||||
## 使用说明
|
## 使用说明
|
||||||
由于 frps 服务端需要配置参数,本脚本为原版 frps.ini ,安装完毕后请自行编辑 frps.ini 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.ini ,在进行一键安装也非常方便.后期也可自行配置 frps.ini 和调整 frps 的版本.
|
由于 frps 服务端需要配置参数,本脚本为原版 frps.ini ,安装完毕后请自行编辑 frps.ini 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.ini ,在进行一键安装也非常方便.后期也可自行配置 frps.ini 和调整 frps 的版本.
|
||||||
@@ -12,6 +18,8 @@
|
|||||||
安装
|
安装
|
||||||
```shell
|
```shell
|
||||||
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
||||||
|
# 国内 gitee 镜像
|
||||||
|
wget https://gitee.com/stilleshan/frps/raw/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
使用
|
使用
|
||||||
@@ -25,28 +33,36 @@ sudo systemctl restart frps
|
|||||||
卸载
|
卸载
|
||||||
```shell
|
```shell
|
||||||
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
||||||
|
# 国内 gitee 镜像
|
||||||
|
wget https://gitee.com/stilleshan/frps/raw/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.ini 文件后运行脚本.)
|
### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.ini 文件后运行脚本.)
|
||||||
|
> 同时支持 github 和 gitee 平台 fork
|
||||||
|
|
||||||
- 首先 fork 本仓库
|
- 首先 fork 本仓库
|
||||||
- 配置 frps.ini
|
- 配置 frps.ini
|
||||||
- 修改 frps_linux_install.sh 脚本
|
- 修改 frps_linux_install.sh 脚本
|
||||||
- 修改脚本链接并运行
|
- 修改脚本链接并运行
|
||||||
|
|
||||||
#### 修改 frps_linux_install.sh 脚本
|
#### 修改 frps_linux_install.sh 脚本
|
||||||
`FRP_VERSION="0.30.0"` 可根据原版项目更新自行修改为最新版本
|
`FRP_VERSION="0.36.2"` 可根据原版项目更新自行修改为最新版本
|
||||||
`REPO="stilleshan/frps"` 由于 **fork** 到你自己的仓库,需修改`stilleshan`为你的GitHub账号ID.
|
`REPO="stilleshan/frps"` 由于 **fork** 到你自己的仓库,需修改`stilleshan`为你的 GitHub 或 gitee 账号ID.
|
||||||
|
|
||||||
#### 运行一键脚本
|
#### 运行一键脚本
|
||||||
修改以下脚本链接中的`stilleshan`为你的GitHub账号ID后,运行即可.
|
修改以下脚本链接中的`stilleshan`为你的 GitHub 或 gitee 账号ID后,运行即可.
|
||||||
```shell
|
```shell
|
||||||
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
||||||
|
# 国内 gitee 镜像
|
||||||
|
wget https://gitee.com/stilleshan/frps/raw/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
|
||||||
```
|
```
|
||||||
#### 卸载脚本
|
#### 卸载脚本
|
||||||
frps_linux_uninstall.sh 卸载脚本为通用脚本,可直接运行,也可同上方式修改链接后运行.
|
frps_linux_uninstall.sh 卸载脚本为通用脚本,可直接运行,也可同上方式修改链接后运行.
|
||||||
```shell
|
```shell
|
||||||
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
||||||
|
# 国内 gitee 镜像
|
||||||
|
wget https://gitee.com/stilleshan/frps/raw/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### frps相关命令
|
### frps相关命令
|
||||||
|
|||||||
@@ -1,28 +1,68 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
FRP_VERSION="0.35.0"
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
REPO="stilleshan/frps"
|
export PATH
|
||||||
WORK_PATH=$(dirname $(readlink -f $0))
|
|
||||||
|
|
||||||
# 创建frp文件夹
|
# fonts color
|
||||||
mkdir -p /usr/local/frp && \
|
Green="\033[32m"
|
||||||
# 下载并移动frps文件
|
Red="\033[31m"
|
||||||
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz && \
|
Yellow="\033[33m"
|
||||||
tar -zxvf frp_${FRP_VERSION}_linux_amd64.tar.gz && \
|
GreenBG="\033[42;37m"
|
||||||
cd frp_${FRP_VERSION}_linux_amd64 && \
|
RedBG="\033[41;37m"
|
||||||
mv frps /usr/local/frp && \
|
Font="\033[0m"
|
||||||
# 下载frps.in和frps.service
|
# fonts color
|
||||||
wget -P /usr/local/frp https://raw.githubusercontent.com/${REPO}/master/frps.ini && \
|
|
||||||
wget -P /lib/systemd/system https://raw.githubusercontent.com/${REPO}/master/frps.service && \
|
# variable
|
||||||
systemctl daemon-reload && \
|
FRP_VERSION=0.37.0
|
||||||
# 启动frps
|
REPO=stilleshan/frps
|
||||||
sudo systemctl start frps && \
|
WORK_PATH=$(dirname $(readlink -f $0))
|
||||||
sudo systemctl enable frps && \
|
FRP_NAME=frps
|
||||||
# 删除多余文件
|
FRP_PATH=/usr/local/frp
|
||||||
cd ${WORK_PATH} && \
|
|
||||||
rm -rf frp_${FRP_VERSION}_linux_amd64 frp_${FRP_VERSION}_linux_amd64.tar.gz frps_linux_install.sh
|
if [ $(uname -m) = "x86_64" ]; then
|
||||||
echo "=======================================================" &&\
|
export PLATFORM=amd64
|
||||||
echo -e "\033[32m安装成功,请先修改 frps.ini 文件,确保格式及配置正确无误!\033[0m" && \
|
else if [ $(uname -m) = "aarch64" ]; then
|
||||||
echo -e "\033[31mvi /usr/local/frp/frps.ini \033[0m" && \
|
export PLATFORM=arm64
|
||||||
echo -e "\033[32m修改完毕后执行以下命令重启服务:\033[0m" && \
|
fi
|
||||||
echo -e "\033[31msudo systemctl restart frps\033[0m" && \
|
fi
|
||||||
echo "======================================================="
|
|
||||||
|
FILE_NAME=frp_${FRP_VERSION}_linux_${PLATFORM}
|
||||||
|
|
||||||
|
# 判断是否安装 frps
|
||||||
|
if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.ini" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then
|
||||||
|
echo -e "${Green}=========================================================================${Font}"
|
||||||
|
echo -e "${RedBG}当前已退出脚本.${Font}"
|
||||||
|
echo -e "${Green}检查到服务器已安装${Font} ${Red}${FRP_NAME}${Font}"
|
||||||
|
echo -e "${Green}请手动确认和删除${Font} ${Red}/usr/local/frp/${Font} ${Green}目录下的${Font} ${Red}${FRP_NAME}${Font} ${Green}和${Font} ${Red}/${FRP_NAME}.ini${Font} ${Green}文件以及${Font} ${Red}/lib/systemd/system/${FRP_NAME}.service${Font} ${Green}文件,再次执行本脚本.${Font}"
|
||||||
|
echo -e "${Green}参考命令如下:${Font}"
|
||||||
|
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}${Font}"
|
||||||
|
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}.ini${Font}"
|
||||||
|
echo -e "${Red}rm -rf /lib/systemd/system/${FRP_NAME}.service${Font}"
|
||||||
|
echo -e "${Green}=========================================================================${Font}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 判断 frps 进程并 kill
|
||||||
|
while ! test -z "$(ps -A | grep -w ${FRP_NAME})"; do
|
||||||
|
FRPSPID=$(ps -A | grep -w ${FRP_NAME} | awk 'NR==1 {print $1}')
|
||||||
|
kill -9 $FRPSPID
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p ${FRP_PATH}
|
||||||
|
wget -P ${WORK_PATH} https://ghproxy.com/https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz && \
|
||||||
|
tar -zxvf ${FILE_NAME}.tar.gz && \
|
||||||
|
mv ${FILE_NAME}/${FRP_NAME} ${FRP_PATH}
|
||||||
|
|
||||||
|
wget -P ${FRP_PATH} https://ghproxy.com/https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini && \
|
||||||
|
wget -P /lib/systemd/system https://ghproxy.com/https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.service && \
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
sudo systemctl start ${FRP_NAME}
|
||||||
|
sudo systemctl enable ${FRP_NAME}
|
||||||
|
rm -rf ${WORK_PATH}/${FILE_NAME}.tar.gz ${WORK_PATH}/${FILE_NAME} ${FRP_NAME}_linux_install.sh
|
||||||
|
|
||||||
|
echo -e "${Green}====================================================================${Font}"
|
||||||
|
echo -e "${Green}安装成功,请先修改 ${FRP_NAME}.ini 文件,确保格式及配置正确无误!${Font}"
|
||||||
|
echo -e "${Red}vi /usr/local/frp/${FRP_NAME}.ini${Font}"
|
||||||
|
echo -e "${Green}修改完毕后执行以下命令重启服务:${Font}"
|
||||||
|
echo -e "${Red}sudo systemctl restart ${FRP_NAME}${Font}"
|
||||||
|
echo -e "${Green}====================================================================${Font}"
|
||||||
|
|||||||
@@ -1,13 +1,32 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
# 停止frps
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
sudo systemctl stop frps && \
|
export PATH
|
||||||
# 删除frps
|
|
||||||
rm -rf /usr/local/frp && \
|
# fonts color
|
||||||
# 删除frps.service
|
Green="\033[32m"
|
||||||
rm -rf /lib/systemd/system/frps.service && \
|
Red="\033[31m"
|
||||||
sudo systemctl daemon-reload && \
|
Yellow="\033[33m"
|
||||||
|
GreenBG="\033[42;37m"
|
||||||
|
RedBG="\033[41;37m"
|
||||||
|
Font="\033[0m"
|
||||||
|
# fonts color
|
||||||
|
|
||||||
|
# variable
|
||||||
|
WORK_PATH=$(dirname $(readlink -f $0))
|
||||||
|
FRP_NAME=frps
|
||||||
|
FRP_VERSION=0.37.0
|
||||||
|
FRP_PATH=/usr/local/frp
|
||||||
|
|
||||||
|
# 停止frpc
|
||||||
|
sudo systemctl stop ${FRP_NAME}
|
||||||
|
# 删除frpc
|
||||||
|
rm -rf ${FRP_PATH}
|
||||||
|
# 删除frpc.service
|
||||||
|
rm -rf /lib/systemd/system/${FRP_NAME}.service
|
||||||
|
sudo systemctl daemon-reload
|
||||||
# 删除本文件
|
# 删除本文件
|
||||||
rm -rf frps_linux_uninstall.sh
|
rm -rf ${FRP_NAME}_linux_uninstall.sh
|
||||||
echo "============================" &&\
|
|
||||||
echo -e "\033[32m卸载成功,相关文件已清理完毕!\033[0m" && \
|
echo -e "${Green}============================${Font}"
|
||||||
echo "============================"
|
echo -e "${Green}卸载成功,相关文件已清理完毕!${Font}"
|
||||||
|
echo -e "${Green}============================${Font}"
|
||||||
|
|||||||
Reference in New Issue
Block a user