Skip to content

Commit

Permalink
feat: support volume storage dir on docker (GopeedLab#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie authored Dec 13, 2023
1 parent 2b5091b commit ce7489b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ FROM alpine:3.14.2
LABEL maintainer="monkeyWie"
WORKDIR /app
COPY --from=go /app/dist/gopeed ./
VOLUME ["/app/storage"]
EXPOSE 9999
ENTRYPOINT ["./gopeed"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Gopeed (full name Go Speed), a high-speed downloader developed by `Golang` + `Flutter`, supports (HTTP, BitTorrent, Magnet) protocol, and supports all platforms. In addition to basic download functions, Gopeed is also a highly customizable downloader that supports implementing more features through integration with [APIs](https://docs.gopeed.com/dev-api.html) or installation and development of [extensions](https://docs.gopeed.com/dev-extension.html).


Visit ✈ [Official Website](https://gopeed.com) | 📖 [Develop Docs](https://docs.gopeed.com)
Visit ✈ [Official Website](https://gopeed.com) | 📖 [Official Docs](https://docs.gopeed.com)

## Install

Expand Down Expand Up @@ -50,6 +50,8 @@ go install github.com/GopeedLab/gopeed/cmd/gopeed@latest
docker run -d -p 9999:9999 -v /path/to/download:/root/Downloads liwei2633/gopeed
```

[More details for docker](https://docs.gopeed.com/install.html#docker-installation)

#### Using Docker Compose

```bash
Expand Down Expand Up @@ -160,7 +162,6 @@ cd ../../
rm -rf cmd/web/dist
cp -r ui/flutter/build/web cmd/web/dist
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/GopeedLab/gopeed/cmd/web
go run cmd/web/main.go
```

## Credits
Expand Down
3 changes: 2 additions & 1 deletion README_ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ go install github.com/GopeedLab/gopeed/cmd/gopeed@latest
docker run -d -p 9999:9999 -v /path/to/download:/root/Downloads liwei2633/gopeed
```

[Dockerの使用については](https://docs.gopeed.com/install.html#docker-installation)

#### Docker Compose の使用

```bash
Expand Down Expand Up @@ -159,7 +161,6 @@ cd ../../
rm -rf cmd/web/dist
cp -r ui/flutter/build/web cmd/web/dist
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/GopeedLab/gopeed/cmd/web
go run cmd/web/main.go
```

## 感謝
Expand Down
5 changes: 3 additions & 2 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

Gopeed(全称 Go Speed),直译过来中文名叫做`够快下载器`(不是狗屁下载器!),是一款由`Golang`+`Flutter`开发的高速下载器,支持(HTTP、BitTorrent、Magnet)协议下载,并且支持全平台使用。除了基本的下载功能外,Gopeed 还是一款高度可定制化的下载器,支持通过对接[APIs](https://docs.gopeed.com/zh/dev-api.html)或者安装和开发[扩展](https://docs.gopeed.com/zh/dev-extension.html)来实现更多的功能。

访问 ✈ [官方网站](https://gopeed.com/zh-CN) | 📖 [开发文档](https://docs.gopeed.com/zh/)
访问 ✈ [官方网站](https://gopeed.com/zh-CN) | 📖 [官方文档](https://docs.gopeed.com/zh/)

## 安装

Expand Down Expand Up @@ -49,6 +49,8 @@ go install github.com/GopeedLab/gopeed/cmd/gopeed@latest
docker run -d -p 9999:9999 -v /path/to/download:/root/Downloads liwei2633/gopeed
```

[更多关于 Docker 的使用](https://docs.gopeed.com/zh/install.html#docker-%E5%AE%89%E8%A3%85)

#### 使用 Docker Compose

```bash
Expand Down Expand Up @@ -159,7 +161,6 @@ cd ../../
rm -rf cmd/web/dist
cp -r ui/flutter/build/web cmd/web/dist
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/GopeedLab/gopeed/cmd/web
go run cmd/web/main.go
```

## 感谢
Expand Down
3 changes: 2 additions & 1 deletion README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ go install github.com/GopeedLab/gopeed/cmd/gopeed@latest
docker run -d -p 9999:9999 -v /path/to/download:/root/Downloads liwei2633/gopeed
```

[更多關於 Docker 的使用](https://docs.gopeed.com/zh/install.html#docker-%E5%AE%89%E8%A3%85)

#### 使用 Docker Compose

```bash
Expand Down Expand Up @@ -159,7 +161,6 @@ cd ../../
rm -rf cmd/web/dist
cp -r ui/flutter/build/web cmd/web/dist
go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/GopeedLab/gopeed/cmd/web
go run cmd/web/main.go
```

## 感謝
Expand Down
9 changes: 9 additions & 0 deletions cmd/web/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/GopeedLab/gopeed/cmd"
"github.com/GopeedLab/gopeed/pkg/rest/model"
"io/fs"
"os"
"path/filepath"
)

//go:embed dist/*
Expand All @@ -29,10 +31,17 @@ func main() {
}
}

exe, err := os.Executable()
if err != nil {
panic(err)
}
dir := filepath.Dir(exe)

cfg := &model.StartConfig{
Network: "tcp",
Address: fmt.Sprintf("%s:%d", *args.Address, *args.Port),
Storage: model.StorageBolt,
StorageDir: filepath.Join(dir, "storage"),
ApiToken: *args.ApiToken,
ProductionMode: true,
WebEnable: true,
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ services:
gopeed:
container_name: gopeed
ports:
- 9999:9999 # HTTP port (host:container)
- "9999:9999" # HTTP port (host:container)
image: liwei2633/gopeed
volumes:
- ~/Downloads:/root/Downloads # replace with your prefer path
- ~/gopeed/Downloads:/root/Downloads # mount download path
#- ~/gopeed/storage:/app/storage # if you need to mount storage path, uncomment this line
restart: unless-stopped

0 comments on commit ce7489b

Please sign in to comment.