Sign inSign up

kajws/frpc

By kajws

•Updated 10 months ago

Image
0

159

kajws/frpc repository overview

⁠FRPC "Easy Config" Docker Image

This directory contains a small wrapper image around fatedier/frpc that generates an frpc.toml config file from environment variables and then starts frpc. This is a convenience image for use in Docker Compose or other Docker workflows where you just want a simple HTTP proxy.

⁠Image
  • Base FRPC image: fatedier/frpc:v0.65.0
  • Wrapper image: built from this directory (copies /usr/bin/frpc from the base image and uses entrypoint.sh).
⁠Config generation

On container start, entrypoint.sh:

  1. Validates required environment variables.
  2. Ensures at least one of FRPC_SUBDOMAIN or FRPC_CUSTOM_DOMAIN is set.
  3. Derives a proxy section name.
  4. Writes a config file (TOML) to FRPC_CONFIG_FILE (default: ./frpc.toml in the container working directory /frp).
  5. Prints the generated config with the token masked.
  6. execs the main container command (by default frpc -c /frp/frpc.toml).
⁠Environment variables
⁠Required
  • FRPC_SERVER: FRP server address (IP or hostname), e.g. frp.example.com.
  • FRPC_TOKEN: FRP auth token used for auth.token.

You must also set at least one of:

  • FRPC_SUBDOMAIN: Subdomain for HTTP proxying (e.g. myapp).
  • FRPC_CUSTOM_DOMAIN: Custom domain for HTTP proxying (e.g. myapp.example.com).

If both FRPC_SUBDOMAIN and FRPC_CUSTOM_DOMAIN are unset, the container will exit with an error.

⁠Optional (with defaults)
  • FRPC_CONFIG_FILE: Path to the generated config file inside the container.

    • Default: ./frpc.toml (in /frp).
  • FRPC_SERVER_PORT: Port of the FRP server.

    • Default: 7000.
  • FRPC_PROXY_PORT: Local port of the proxied service.

    • Default: 80.
  • FRPC_PROXY_HOST: Hostname/IP of the local service to proxy.

    • Default: 127.0.0.1.
  • FRPC_PROXY_NAME: Name of the proxy section.

    • Default resolution order:
      1. FRPC_PROXY_NAME (if set),
      2. else FRPC_SUBDOMAIN (if set),
      3. else FRPC_CUSTOM_DOMAIN.
  • FRPC_USE_COMPRESSION: When set to any non-empty value, enables compression:

    • Writes transport.useCompression = true into the config.
⁠Generated config structure

The generated frpc.toml has the general shape:

serverAddr = "<FRPC_SERVER>"
serverPort = <FRPC_SERVER_PORT>
auth.method = "token"
auth.token = "<FRPC_TOKEN>"

[[proxies]]
name = "<resolved section name>"
type = "http"
localIP = "<FRPC_PROXY_HOST>"
localPort = <FRPC_PROXY_PORT>

# Optionally:
# subdomain = "<FRPC_SUBDOMAIN>"
# customDomains = ["<FRPC_CUSTOM_DOMAIN>"]
# transport.useCompression = true
⁠Example: docker-compose

Below is an example docker-compose.yml snippet showing how to use this image.
Note: All values here are sample values only; replace with your own server address, token, and domains.

services:
  myapp:
    image: nginx:latest

  frpc:
    image: kajws/frpc:v0.65.0
    depends_on:
      - myapp
    environment:
      - FRPC_PROXY_NAME=myapp
      - FRPC_PROXY_HOST=myapp
      - FRPC_PROXY_PORT=80
      - FRPC_SERVER=frp.example.com
      - FRPC_TOKEN=change-me-token
      # Use exactly one of the following, or both if you want:
      # - FRPC_CUSTOM_DOMAIN=myapp.example.com
      - FRPC_SUBDOMAIN=myapp
      - FRPC_USE_COMPRESSION=true

Tag summary

Content type

Image

Digest

sha256:257496123…

Size

9.7 MB

Last updated

10 months ago

docker pull kajws/frpc:v0.65.0