This document provides an overview of the development workflow, build system, and deployment processes for the frp project. It covers how to build frp from source, cross-compile for multiple platforms, leverage the CI/CD pipeline, and deploy using Docker or standalone binaries.
For detailed information about testing infrastructure and quality assurance, see Testing and Quality Assurance. For configuration and runtime aspects, see Configuration System.
The frp project uses a multi-layered build and deployment system designed to support:
The build system is organized around three primary tools:
Makefile for local builds and developmentMakefile.cross-compiles for multi-platform binary generationpackage.sh for creating distributable archivesSources: Makefile1-89 Makefile.cross-compiles1-38 package.sh1-75
Workflow: Source Code to Deployment
The development workflow follows a progression from source modification through testing to final distribution.
Sources: Makefile1-89 .github/workflows/build-and-push-image.yml1-84 .circleci/config.yml1-25
The build system provides multiple entry points for different development and release scenarios:
| Target | Purpose | Output | Build Flags |
|---|---|---|---|
make all | Full build with web assets | bin/frpc, bin/frps | -trimpath -ldflags "-s -w" |
make build | Build binaries only | bin/frpc, bin/frps | CGO_ENABLED=0 |
make web | Build web UI assets | web/*/dist/ | npm build |
make test | Run unit tests | Test results | go test -v --cover |
make e2e | Run E2E tests | Test results | via hack/run-e2e.sh |
make fmt | Format code | Formatted source | go fmt ./... |
make vet | Static analysis | Analysis results | go vet ./... |
Sources: Makefile10-89
Both frpc and frps include embedded web dashboards that must be built before binary compilation:
Web Asset Build Pipeline
The Makefile coordinates web asset compilation before Go builds. For details on local build setup, see Building from Source.
Sources: Makefile17-23 dockerfiles/Dockerfile-for-frpc1-9 dockerfiles/Dockerfile-for-frps1-9
All production builds use consistent optimization flags to reduce binary size and improve security:
| Flag | Purpose | Effect |
|---|---|---|
CGO_ENABLED=0 | Disable CGO | Pure Go binary, static linking |
-trimpath | Remove file system paths | Security and reproducibility |
-ldflags "-s -w" | Strip debug info | Reduce binary size (~30-50%) |
-tags frpc/-tags frps | Build tags | Include only client or server code |
The -tags flag enables conditional compilation, ensuring that frpc binaries do not include server-specific code and vice versa.
Sources: Makefile3-41 Makefile.cross-compiles3-31
The cross-compilation system builds binaries for 17 platform/architecture combinations, including Android, MIPS, and RISC-V. For architecture-specific configurations, see Cross-Platform Compilation.
Cross-Platform Build Matrix
Sources: Makefile.cross-compiles5 package.sh20-22
Cross-compiled binaries are output to the release/ directory with platform-specific naming. Windows binaries are automatically renamed with the .exe extension.
Sources: Makefile.cross-compiles30-37
The package.sh script creates distributable archives for all cross-compiled binaries:
Package Creation Workflow
Sources: package.sh1-75
The project uses GitHub Actions for linting, image building, and automated releases. CircleCI is utilized for running the full test suite across the codebase. For details on the release automation and testing workflows, see CI/CD Pipeline.
| Workflow | Trigger | Purpose | File |
|---|---|---|---|
golangci-lint | Push/PR | Code quality enforcement | .github/workflows/golangci-lint.yml |
build-and-push-image | Release published | Build and publish Docker images | .github/workflows/build-and-push-image.yml |
goreleaser | Manual dispatch | Create GitHub releases with binaries | .github/workflows/goreleaser.yml |
Sources: .github/workflows/golangci-lint.yml1-36 .github/workflows/build-and-push-image.yml1-84 .github/workflows/goreleaser.yml1-39
The project uses golangci-lint with a comprehensive set of linters including errcheck, gosec, and staticcheck. Formatting is enforced using gofumpt and gci.
Sources: .golangci.yml1-120 Makefile25-32
frp provides multi-stage Docker builds that result in small, secure images based on Alpine Linux. For deployment instructions and image structure, see Docker Deployment.
Docker Multi-Stage Build Process
Sources: dockerfiles/Dockerfile-for-frpc1-26 dockerfiles/Dockerfile-for-frps1-26
The project maintains a compatibility floor (currently v0.61.0) and runs E2E tests against older versions of frpc and frps to ensure protocol stability.
Sources: Makefile5-79
Refresh this wiki