mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-17 12:53:02 +00:00
增加 ghcr.io 容器构建
This commit is contained in:
35
.github/workflows/maven.yml
vendored
35
.github/workflows/maven.yml
vendored
@@ -11,6 +11,7 @@ name: Java CI with Maven
|
|||||||
# The API requires write permission on the repository to submit dependencies
|
# The API requires write permission on the repository to submit dependencies
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -25,12 +26,23 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '18'
|
||||||
|
cache: 'yarn'
|
||||||
|
cache-dependency-path: 'web-front/yarn.lock'
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: maven
|
cache: maven
|
||||||
|
|
||||||
|
- name: Build Frontend
|
||||||
|
run: cd web-front && yarn install && yarn run build
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
@@ -43,3 +55,26 @@ jobs:
|
|||||||
# - uses: release-drafter/release-drafter@v5
|
# - uses: release-drafter/release-drafter@v5
|
||||||
# env:
|
# env:
|
||||||
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: web-service/target/netdisk-fast-download-bin.zip
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}:${{ github.sha }}
|
||||||
|
ghcr.io/${{ github.repository }}:main
|
||||||
|
|||||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM eclipse-temurin:17-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY ./web-service/target/netdisk-fast-download-bin.zip .
|
||||||
|
|
||||||
|
RUN unzip netdisk-fast-download-bin.zip && \
|
||||||
|
mv netdisk-fast-download/* ./ && \
|
||||||
|
rm netdisk-fast-download-bin.zip && \
|
||||||
|
chmod +x run.sh
|
||||||
|
|
||||||
|
EXPOSE 6400 6401
|
||||||
|
|
||||||
|
ENTRYPOINT ["sh", "run.sh"]
|
||||||
25
README.md
25
README.md
@@ -153,6 +153,31 @@ mvn package
|
|||||||
```
|
```
|
||||||
打包好的文件位于 web-service/target/netdisk-fast-download-bin.zip
|
打包好的文件位于 web-service/target/netdisk-fast-download-bin.zip
|
||||||
## Linux服务部署
|
## Linux服务部署
|
||||||
|
|
||||||
|
### Docker 部署(Main分支)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# 创建目录
|
||||||
|
mkdir -p netdisk-fast-download
|
||||||
|
cd netdisk-fast-download
|
||||||
|
|
||||||
|
# 拉取镜像
|
||||||
|
docker pull ghcr.io/qaiu/netdisk-fast-download:main
|
||||||
|
|
||||||
|
# 复制配置文件(或下载仓库web-service\src\main\resources)
|
||||||
|
docker create --name netdisk-fast-download ghcr.io/qaiu/netdisk-fast-download:main
|
||||||
|
docker cp netdisk-fast-download:/app/resources ./resources
|
||||||
|
docker rm netdisk-fast-download
|
||||||
|
|
||||||
|
# 启动容器
|
||||||
|
docker run -d -it --name netdisk-fast-download -p 6401:6401 --restart unless-stopped -e TZ=Asia/Shanghai -v ./resources:/app/resources -v ./db:/app/db -v ./logs:/app/logs ghcr.io/qaiu/netdisk-fast-download:main
|
||||||
|
|
||||||
|
# 反代6401端口
|
||||||
|
|
||||||
|
# 升级容器
|
||||||
|
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --run-once netdisk-fast-download
|
||||||
|
```
|
||||||
|
|
||||||
### [宝塔安装参考](https://blog.qaiu.top/archives/netdisk-fast-download-bao-ta-an-zhuang-jiao-cheng)
|
### [宝塔安装参考](https://blog.qaiu.top/archives/netdisk-fast-download-bao-ta-an-zhuang-jiao-cheng)
|
||||||
> 注意: netdisk-fast-download.service中的ExecStart的路径改为实际路径
|
> 注意: netdisk-fast-download.service中的ExecStart的路径改为实际路径
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
Reference in New Issue
Block a user