From 431ad01355a1a26c47eb14a9523cb229c29c9d0d Mon Sep 17 00:00:00 2001 From: BaoXuebin Date: Sun, 5 Dec 2021 13:10:59 +0800 Subject: [PATCH] add dockerfile --- white_list.json => config/white_list.json | 0 docker-compose.yml | 14 ++++++++++++++ dockerfile | 18 ++++++++++++++++++ script/paths.go | 4 ++-- 4 files changed, 34 insertions(+), 2 deletions(-) rename white_list.json => config/white_list.json (100%) create mode 100644 docker-compose.yml create mode 100644 dockerfile diff --git a/white_list.json b/config/white_list.json similarity index 100% rename from white_list.json rename to config/white_list.json diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f777a36 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.9" +services: + app: + container_name: beancount-gs + image: xdbin/beancount-gs:0.0.1 + 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}:/beancount" + - "${dataPath:-/data/beancount}/icons:/app/public/icons" + - "${dataPath:-/data/beancount}/config:/app/config" \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..d36815f --- /dev/null +++ b/dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1 +FROM golang:1.17.3 + +ENV GO111MODULE=on \ + GOPROXY=https://goproxy.cn,direct \ + GIN_MODE=release \ + PORT=80 + +# install beancount +RUN apt-get update || : && apt-get install python3.5 python3-pip -y +RUN pip3 install beancount -i https://pypi.tuna.tsinghua.edu.cn/simple + +WORKDIR /app +COPY . . +COPY public/icons ./public/default_icons +RUN go build . + +EXPOSE 80 \ No newline at end of file diff --git a/script/paths.go b/script/paths.go index e07792d..c7022c2 100644 --- a/script/paths.go +++ b/script/paths.go @@ -3,11 +3,11 @@ package script import "os" func GetServerConfigFilePath() string { - return "./config.json" + return "./config/config.json" } func GetServerWhiteListFilePath() string { - return "./white_list.json" + return "./config/white_list.json" } func GetServerLedgerConfigFilePath() string {