1 安装
初意 edited this page 2023-07-02 16:59:24 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(以下安装方法适用于1.1.12以上版本)

本地安装

  1. 安装 Golang
  2. 安装 beancount
  3. 克隆本项目或者下载Zip压缩包
  4. 根目录执行 go build 打包
  5. 执行服务,访问 http://localhost:10000

Docker

docker run --name beancount-gs -dp 10000:80 \
-w /app \
-v "/data/beancount:/data/beancount" \
-v "/data/beancount/icons:/app/public/icons" \
-v "/data/beancount/config:/app/config" \
-v "/data/beancount/logs:/app/logs" \
xdbin/beancount-gs:latest \
sh -c "cp -rn /app/public/default_icons/* /app/public/icons && ./beancount-gs -p 80"

Docker Compose

你也可以使用 docker-compose 启动镜像,创建 docker-compose.yml 文件(将下面的内容拷贝进文件)

version: "3.9"
services:
  app:
    container_name: beancount-gs
    image: xdbin/beancount-gs:${tag:-latest}
    ports:
      - "10000:80"
    # volumes 挂载目录会导 /app/public/icons 中的图标被覆盖,这里将默认图标在挂载后重新拷贝图标
    command: >
      sh -c "cp -rn /app/public/default_icons/* /app/public/icons && ./beancount-gs -p 80"      
    volumes:
      - "${dataPath:-/data/beancount}:/data/beancount"
      - "${dataPath:-/data/beancount}/icons:/app/public/icons"
      - "${dataPath:-/data/beancount}/config:/app/config"
      - "${dataPath:-/data/beancount}/bak:/app/bak"
      - "${dataPath:-/data/beancount}/logs:/app/logs"

执行 docker-compose up -d

自定义参数变量

默认的文件存储路径为 /data/beancount如果你想更换其他路径可以在当前目录下新建 var.env然后将下面内容复制到这个文件tag 可以指定镜像版本dataPath 指定文件存储路径

tag=latest
dataPath=自定义的目录

执行 docker-compose --env-file ./var.env up -d