Files
FileCodeBox/docs/guide/getting-started.md
jcbl1 588af7b6c3 perf(runtime): enable uvloop/httptools and tune container memory/keep-alive
- deps: pin uvloop 0.23.0 (non-Windows marker) and httptools 0.9.0; uvicorn's
  --loop/--http auto picks both up. Lockfile regenerated with constraints so
  only these two packages are added (no transitive version drift).
- Dockerfile: expose TIMEOUT_KEEP_ALIVE (default 5, passed to uvicorn) and
  MALLOC_TRIM_THRESHOLD_=65536 so glibc returns freed heap to the OS after
  large transfers. Defaults keep previous behaviour.
- ci: allow `; marker` pins in the lockfile drift check, otherwise uvloop
  would be silently skipped and never verified.
- docs: document both environment variables (zh/en).
- tests: pin the Dockerfile/requirements/lockfile runtime contract.
2026-10-24 08:16:54 +00:00

3.7 KiB
Raw Permalink Blame History

快速开始

简介

FileCodeBox 是一个简单高效的文件分享工具,支持文件临时中转、分享和管理。本指南将帮助您快速部署和使用 FileCodeBox。

特性

  • 🚀 快速部署:支持 Docker 一键部署
  • 🔒 安全可靠:文件访问需要提取码
  • ⏱️ 时效控制:支持设置文件有效期
  • 📊 下载限制:可限制文件下载次数
  • 🖼️ 文件预览:支持图片、视频、音频等多种格式预览
  • 📱 响应式设计:完美适配移动端和桌面端

部署方式

Docker 部署(推荐)

快速启动

docker run -d --restart unless-stopped \
  -p 12345:12345 \
  -v fcb-data:/app/data \
  -e APP_ENV=production \
  -e LOG_LEVEL=warning \
  --log-opt max-size=10m \
  --log-opt max-file=3 \
  --name filecodebox \
  lanol/filecodebox:latest

Docker Compose

version: "3"
services:
  file-code-box:
    image: lanol/filecodebox:latest
    volumes:
      - fcb-data:/app/data:rw
    restart: unless-stopped
    ports:
      - "12345:12345"
    environment:
      - APP_ENV=production
      - WORKERS=1
      - LOG_LEVEL=warning
      - ACCESS_LOG=false
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"
volumes:
  fcb-data:
    external: false

环境变量

变量 默认值 说明
HOST 0.0.0.0 服务监听地址
PORT 12345 服务端口
WORKERS 1 工作进程数;SQLite 部署建议保持单进程
APP_ENV production(Docker) 运行环境;生产环境默认关闭 HTTP 访问日志
LOG_LEVEL warning(Docker) 日志级别:debug/info/warning/error
ACCESS_LOG false(生产环境) 是否启用 HTTP 访问日志;调试请求时可设为 true
TIMEOUT_KEEP_ALIVE 5 HTTP Keep-Alive 空闲超时(秒);前置反向代理后可调大以减少重复握手
MALLOC_TRIM_THRESHOLD_ 65536 glibc 归还空闲堆的阈值(字节);降低大文件请求后的常驻内存(仅 glibc 镜像生效)

生产环境默认只输出 warning、error 等关键日志,并限制 Docker 日志最多保留 3 个 10 MB 文件。

自定义配置示例

docker run -d --restart=always \
  -p 12345:12345 \
  -v fcb-data:/app/data \
  -e WORKERS=1 \
  -e APP_ENV=production \
  -e LOG_LEVEL=warning \
  --name filecodebox \
  --log-opt max-size=10m \
  --log-opt max-file=3 \
  lanol/filecodebox:latest

配置反向代理(Nginx)

location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:12345;
}

手动部署

  1. 克隆项目
git clone https://github.com/vastsa/FileCodeBox.git
  1. 安装依赖
cd FileCodeBox
pip install -r requirements.txt
  1. 启动服务
python main.py

使用方法

  1. 访问系统 打开浏览器访问 http://localhost:12345

  2. 上传文件

    • 点击上传按钮或拖拽文件到上传区域
    • 设置文件有效期和下载次数限制
    • 获取分享链接和提取码
  3. 下载文件

    • 访问分享链接
    • 输入提取码
    • 下载文件
  4. 后台管理

    • 首次访问 http://localhost:12345 完成初始化
    • 访问 http://localhost:12345/#/admin
    • 输入初始化时设置的管理员密码
    • 进入后台管理页面
    • 查看系统信息、文件列表、活动记录和系统配置

下一步