Skip to content

Commit cc8e768

Browse files
feat: add frp docker files (#52)
* feat: add frp docker files * feat: add config * feat: auto push image to ghcr * feat: change default port * fix: bump gh action version
1 parent 1637e98 commit cc8e768

File tree

5 files changed

+90
-0
lines changed

5 files changed

+90
-0
lines changed

.github/workflows/frp.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Push frp Docker Image
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'dockerfiles/frps/*'
8+
- 'dockerfiles/frpc/*'
9+
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Build and push frps Docker image
29+
uses: docker/build-push-action@v6
30+
with:
31+
context: ./dockerfiles/frps
32+
push: true
33+
tags: ghcr.io/${{ github.repository_owner }}/frps:latest
34+
35+
- name: Build and push frpc Docker image
36+
uses: docker/build-push-action@v6
37+
with:
38+
context: ./dockerfiles/frpc
39+
push: true
40+
tags: ghcr.io/${{ github.repository_owner }}/frpc:latest

dockerfiles/frpc/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# build frpc
2+
FROM golang:1.19 AS building
3+
WORKDIR /
4+
RUN git clone https://github.com/huggingface/frp.git
5+
WORKDIR /frp
6+
RUN make frpc
7+
8+
# run frpc
9+
FROM alpine:3
10+
11+
COPY --from=building /frp/bin/frpc /usr/bin/frpc
12+
13+
COPY frpc.ini /etc/frp/frpc.ini
14+
15+
ENTRYPOINT ["/usr/bin/frpc", "-c", "/etc/frp/frpc.ini"]

dockerfiles/frpc/frpc.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[common]
2+
server_addr = my-server.com
3+
server_port = 6276
4+
5+
[http]
6+
type = tcp
7+
local_ip = 0.0.0.0
8+
local_port = 1211
9+
remote_port = 80

dockerfiles/frps/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# build frps
2+
FROM golang:1.19 AS building
3+
WORKDIR /
4+
RUN git clone https://github.com/huggingface/frp.git
5+
WORKDIR /frp
6+
RUN make frps
7+
8+
# run frps
9+
FROM alpine:3
10+
COPY --from=building /frp/bin/frps /usr/bin/frps
11+
RUN apk add curl
12+
13+
HEALTHCHECK --interval=1m --timeout=30s --retries=3 CMD curl --fail http://localhost:7001/healthz || exit 1
14+
15+
COPY frps.ini /etc/frp/frps.ini
16+
17+
ENTRYPOINT ["/usr/bin/frps", "-c", "/etc/frp/frps.ini"]

dockerfiles/frps/frps.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[common]
2+
log_level = trace
3+
tcp_mux = true
4+
bind_port = 6276 # 6276 represents MCPM on a T9 keypad (6=M, 2=C, 7=P, 6=M)
5+
dashboard_port = 6277
6+
vhost_http_port = 80
7+
subdomain_host = my-gpt-wrapper.com
8+
detailed_errors_to_client = false
9+
custom_404_page = /etc/frp/my-404.html

0 commit comments

Comments
 (0)