initial commit

This commit is contained in:
WeeXnes 2024-09-22 22:29:27 +02:00
commit 587b3d02e1
3 changed files with 72 additions and 0 deletions

23
Dockerfile Normal file
View file

@ -0,0 +1,23 @@
ARG BUILD_FROM
FROM $BUILD_FROM
RUN apk add --no-cache curl
# Download FRP
RUN curl -L https://github.com/fatedier/frp/releases/download/v0.60.0/frp_0.60.0_linux_amd64.tar.gz -o frp.tar.gz
# Extract the downloaded tar.gz file
RUN tar -zxvf frp.tar.gz
# Move the FRPC binary to the desired location
RUN mv frp_0.60.0_linux_amd64/frpc /usr/local/bin/
# Clean up by removing unnecessary files
RUN rm -rf frp.tar.gz frp_0.60.0_linux_amd64
# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

24
config.yaml Normal file
View file

@ -0,0 +1,24 @@
name: "FRP (Fast Reverse Proxy)"
description: "Expose internal services (like Home Assistant) securely to the internet using FRP"
version: "0.60.0"
slug: "frp"
init: false
arch:
- amd64
network:
mode: host
options:
server_addr: "<YOUR_FRP_SERVER_IP>"
server_port: 2113
token: "<YOUR_FRP_TOKEN>"
local_ip: "<actual local ip - e.g. 192.XXX...>"
local_port: 8123
remote_port: 8123
schema:
server_addr: str
server_port: int
token: str
local_ip: str
local_port: int
remote_port: int

25
run.sh Normal file
View file

@ -0,0 +1,25 @@
#!/usr/bin/with-contenv bashio
server_addr=$(bashio::config 'server_addr')
server_port=$(bashio::config 'server_port')
token=$(bashio::config 'token')
local_ip=$(bashio::config 'local_ip')
local_port=$(bashio::config 'local_port')
remote_port=$(bashio::config 'remote_port')
# Create FRP configuration file
echo "[common]" > /etc/frpc.ini
echo "server_addr = ${server_addr}" >> /etc/frpc.ini
echo "server_port = ${server_port}" >> /etc/frpc.ini
echo "token = ${token}" >> /etc/frpc.ini
echo "[ha_dashboard]" >> /etc/frpc.ini
echo "type = tcp" >> /etc/frpc.ini
echo "local_ip = ${local_ip}" >> /etc/frpc.ini
echo "local_port = ${local_port}" >> /etc/frpc.ini
echo "remote_port = ${remote_port}" >> /etc/frpc.ini
echo "--------------- FRP Configuration (frpc.ini): -----------------------"
cat /etc/frpc.ini
echo "Starting FRP Service..."
/usr/local/bin/frpc -c /etc/frpc.ini