mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-06 16:40:32 +00:00
feat: docker support (#43)
This commit is contained in:
1 parent
e9442edd94
commit
95eb3a427c
9 files changed
+85
-18
No files matched your search
@@ -44,6 +44,8 @@ jobs:
|
||||
cp $system\vcruntime140.dll $release
|
||||
cp $system\vcruntime140_1.dll $release
|
||||
|
||||
Compress-Archive -Path $release -DestinationPath build\windows\Output\Gopeed-$env:VERSION-windows-amd64.zip
|
||||
|
||||
cd build/windows
|
||||
echo @"
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
@@ -95,7 +97,7 @@ jobs:
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
"@ > setup.iss
|
||||
iscc.exe setup.iss
|
||||
mv "Output\gopeed.exe" "Output\Gopeed-$env:VERSION-windows-amd64.exe"
|
||||
mv "Output\gopeed.exe" "Output\Gopeed-$env:VERSION-windows-amd64-install.exe"
|
||||
- name: Upload
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
with:
|
||||
@@ -318,3 +320,18 @@ jobs:
|
||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
||||
asset_path: dist/zip/*
|
||||
overwrite: true
|
||||
build-docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [get_release]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
env:
|
||||
VERSION: ${{ needs.get_release.outputs.tag_name }}
|
||||
run: |
|
||||
tag=liwei2633/gopeed:$VERSION
|
||||
docker build -t $tag .
|
||||
docker login -u liwei2633 -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
docker push $tag
|
||||
docker tag $tag liwei2633/gopeed:latest
|
||||
docker push liwei2633/gopeed:latest
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
FROM cirrusci/flutter:3.3.7 AS flutter
|
||||
WORKDIR /app
|
||||
COPY ./ui/flutter/pubspec.yaml ./ui/flutter/pubspec.lock ./
|
||||
RUN flutter pub get
|
||||
COPY ./ui/flutter ./
|
||||
RUN flutter build web
|
||||
|
||||
FROM golang:1.19.3 AS go
|
||||
WORKDIR /app
|
||||
COPY ./go.mod ./go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
COPY --from=flutter /app/build/web/* ./cmd/web/dist
|
||||
RUN go build -tags nosqlite,web -ldflags="-s -w" -o dist/gopeed github.com/monkeyWie/gopeed/cmd/web
|
||||
|
||||
FROM alpine:3.14.2
|
||||
LABEL maintainer="monkeyWie"
|
||||
WORKDIR /app
|
||||
COPY --from=go /app/dist/gopeed ./
|
||||
EXPOSE 9999
|
||||
ENTRYPOINT ["./gopeed"]
|
||||
@@ -21,6 +21,7 @@ Gopeed is a high-speed downloader developed by `Golang`+`Flutter`, which support
|
||||
- [x] android
|
||||
- [ ] ios
|
||||
- [x] web
|
||||
- [x] docker
|
||||
|
||||
[To Release](https://github.com/monkeyWie/gopeed/releases/latest)
|
||||
|
||||
@@ -32,6 +33,15 @@ use `go install`:
|
||||
go install github.com/monkeyWie/gopeed/cmd/gopeed
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
docker run liwei2633/gopeed:latest -v /path/to/download:/download -p 9999:9999
|
||||
```
|
||||
|
||||
When the docker container is running, you can access the web page through `http://localhost:9999`.
|
||||
> Tip: Modify the download path to `/download` on the setting page to access the downloaded files on the host.
|
||||
|
||||
## Showcase
|
||||
|
||||

|
||||
|
||||
@@ -21,6 +21,7 @@ Gopeed 是一款由`Golang`+`Flutter`开发的高速下载器,支持(HTTP、
|
||||
- [x] android
|
||||
- [ ] ios
|
||||
- [x] web
|
||||
- [x] docker
|
||||
|
||||
[点击前往](https://github.com/monkeyWie/gopeed/releases/latest)
|
||||
|
||||
@@ -32,6 +33,15 @@ Gopeed 是一款由`Golang`+`Flutter`开发的高速下载器,支持(HTTP、
|
||||
go install github.com/monkeyWie/gopeed/cmd/gopeed
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
docker run liwei2633/gopeed:latest -v /path/to/download:/download -p 9999:9999
|
||||
```
|
||||
|
||||
当 docker 容器运行时,可以通过 `http://localhost:9999` 访问 web 页面。
|
||||
> 提示:在设置页面把下载路径修改为 `/download` 以便在宿主机访问下载完的文件。
|
||||
|
||||
## 界面展示
|
||||
|
||||

|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ func main() {
|
||||
cfg := &model.StartConfig{
|
||||
Network: "tcp",
|
||||
Address: "127.0.0.1:9999",
|
||||
Storage: model.StorageMem,
|
||||
Storage: model.StorageBolt,
|
||||
WebEnable: true,
|
||||
WebFS: sub,
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
import 'model/create_task.dart';
|
||||
import 'model/request.dart';
|
||||
import 'model/resource.dart';
|
||||
@@ -26,7 +27,9 @@ class _Client {
|
||||
final isUnixSocket = LibgopeedBoot.instance.config.network == 'unix';
|
||||
dio.options.baseUrl = isUnixSocket
|
||||
? 'http://127.0.0.1'
|
||||
: 'http://${LibgopeedBoot.instance.config.address}';
|
||||
: (Util.isWeb()
|
||||
? ""
|
||||
: 'http://${LibgopeedBoot.instance.config.address}');
|
||||
_instance!.dio = dio;
|
||||
if (isUnixSocket) {
|
||||
(_instance!.dio.httpClientAdapter as DefaultHttpClientAdapter)
|
||||
|
||||
@@ -9,7 +9,7 @@ class LibgopeedConfig {
|
||||
|
||||
LibgopeedConfig({
|
||||
this.network = "tcp",
|
||||
this.address = "127.0.0.1:9999",
|
||||
this.address = "127.0.0.1:0",
|
||||
this.refreshInterval = 500,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gopeed/i18n/messages.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
import '../../setting/setting.dart';
|
||||
import '../../widget/directory_selector.dart';
|
||||
|
||||
@@ -69,7 +70,9 @@ class SettingView extends GetView<SettingController> {
|
||||
controller.setting.value.downloadDir) {
|
||||
controller.setting.value.downloadDir =
|
||||
downloadDirController.text;
|
||||
controller.clearTapStatus();
|
||||
if (Util.isDesktop()) {
|
||||
controller.clearTapStatus();
|
||||
}
|
||||
|
||||
await debounceSave();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gopeed/util/util.dart';
|
||||
|
||||
import '../util/mac_secure_util.dart';
|
||||
|
||||
@@ -23,7 +24,7 @@ class _DirectorySelectorState extends State<DirectorySelector> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
readOnly: true,
|
||||
readOnly: Util.isWeb() ? false : true,
|
||||
controller: widget.controller,
|
||||
decoration: widget.showLabel
|
||||
? InputDecoration(
|
||||
@@ -34,18 +35,20 @@ class _DirectorySelectorState extends State<DirectorySelector> {
|
||||
return v!.trim().isNotEmpty ? null : 'setting.downloadDirValid'.tr;
|
||||
},
|
||||
)),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.folder_open),
|
||||
onPressed: () async {
|
||||
if (GetPlatform.isDesktop) {
|
||||
var dir = await getDirectoryPath();
|
||||
if (dir != null) {
|
||||
widget.controller.text = dir;
|
||||
MacSecureUtil.saveBookmark(dir);
|
||||
}
|
||||
}
|
||||
})
|
||||
],
|
||||
!Util.isDesktop()
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.folder_open),
|
||||
onPressed: () async {
|
||||
if (GetPlatform.isDesktop) {
|
||||
var dir = await getDirectoryPath();
|
||||
if (dir != null) {
|
||||
widget.controller.text = dir;
|
||||
MacSecureUtil.saveBookmark(dir);
|
||||
}
|
||||
}
|
||||
})
|
||||
].where((e) => e != null).map((e) => e!).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user