Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e5bf040dc | |||
| 1a8827a67a | |||
| 761b1d3b27 | |||
| fb66b2c359 | |||
| ad1b096a3b | |||
| 2d992e36ec | |||
| 91f3da635d | |||
| 93c4339039 | |||
| e5cf2c1367 | |||
| 0e984c46b4 | |||
| 440aa96ad6 | |||
| cfd4e8cb6d | |||
| b8fda4322f | |||
| 0cfd617922 | |||
| 4801b3de08 | |||
| 25c76aebf2 |
+1
-2
@@ -1,3 +1,2 @@
|
|||||||
frontend/node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
frontend/dist
|
|
||||||
+12
-24
@@ -5,7 +5,7 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build ushare:
|
build and run u-api:
|
||||||
runs-on: tencent-sg
|
runs-on: tencent-sg
|
||||||
steps:
|
steps:
|
||||||
- name: prepare enviroment
|
- name: prepare enviroment
|
||||||
@@ -17,6 +17,9 @@ jobs:
|
|||||||
- name: print operator
|
- name: print operator
|
||||||
run: whoami
|
run: whoami
|
||||||
|
|
||||||
|
- name: print work dir and files
|
||||||
|
run: pwd & ls -alsh .
|
||||||
|
|
||||||
- name: print tag name
|
- name: print tag name
|
||||||
run: echo "Tag name = ${{ gitea.ref_name }}"
|
run: echo "Tag name = ${{ gitea.ref_name }}"
|
||||||
|
|
||||||
@@ -26,29 +29,14 @@ jobs:
|
|||||||
${{ secrets.DOCKER_CONFIG }}
|
${{ secrets.DOCKER_CONFIG }}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: print work dir and files
|
- name: build by kaniko in docker
|
||||||
run: pwd & ls -alsh .
|
run: |
|
||||||
|
docker run --rm -v $(pwd):/workspace \
|
||||||
- name: build image by docker build
|
-v $(pwd)/.docker.config.json:/kaniko/.docker/config.json:ro \
|
||||||
run: docker build -t gitea.loveuer.com/loveuer/build/ushare:${{ gitea.ref_name }} .
|
gcr.io/kaniko-project/executor:latest \
|
||||||
|
'-f /workspace/Dockerfile' \
|
||||||
- name: login repository
|
'-d "gitea.loveuer.com/loveuer/build/ushare:${{ gitea.ref_name }}"' \
|
||||||
run: echo ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} | docker login --username loveuer --password-stdin gitea.loveuer.com/loveuer
|
'--single-snapshot'
|
||||||
|
|
||||||
- name: push image to repository
|
|
||||||
run: docker push gitea.loveuer.com/loveuer/build/ushare:${{ gitea.ref_name }}
|
|
||||||
|
|
||||||
# - name: build by kaniko in docker
|
|
||||||
# run: |
|
|
||||||
# docker run --rm -v $(pwd):/workspace \
|
|
||||||
# -v $(pwd)/.docker.config.json:/kaniko/.docker/config.json:ro \
|
|
||||||
# alpine:latest \
|
|
||||||
# ls -alsh /workspace
|
|
||||||
# gcr.io/kaniko-project/executor:latest \
|
|
||||||
# --dockerfile=/workspace/Dockerfile \
|
|
||||||
# --context=/workspace \
|
|
||||||
# --destination=gitea.loveuer.com/loveuer/build/u-api:${{ gitea.ref_name }} \
|
|
||||||
# --single-snapshot
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
+1
-4
@@ -27,12 +27,9 @@ COPY --from=backend-builder /app/ushare /usr/local/bin/ushare
|
|||||||
# 配置 Nginx
|
# 配置 Nginx
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
COPY deployment/nginx.conf /etc/nginx/conf.d
|
COPY deployment/nginx.conf /etc/nginx/conf.d
|
||||||
COPY deployment/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
|
|
||||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
||||||
|
|
||||||
# 开放端口
|
# 开放端口
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
# 启动服务
|
# 启动服务
|
||||||
ENTRYPOINT ["entrypoint.sh"]
|
CMD sh -c "ushare & nginx -g 'daemon off;'"
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# 启动后端服务(带参数后台运行)
|
|
||||||
echo "启动后端服务,参数: $@"
|
|
||||||
ushare "$@" &
|
|
||||||
BACKEND_PID=$!
|
|
||||||
|
|
||||||
# 定义优雅关闭函数
|
|
||||||
graceful_shutdown() {
|
|
||||||
echo "接收到终止信号,开始优雅关闭..."
|
|
||||||
|
|
||||||
# 先关闭 Nginx
|
|
||||||
echo "关闭 Nginx..."
|
|
||||||
nginx -s quit 2>/dev/null || kill -TERM $NGINX_PID 2>/dev/null
|
|
||||||
|
|
||||||
# 关闭后端服务
|
|
||||||
echo "关闭后端服务 PID $BACKEND_PID..."
|
|
||||||
kill -TERM $BACKEND_PID 2>/dev/null
|
|
||||||
|
|
||||||
# 等待进程终止
|
|
||||||
wait $BACKEND_PID $NGINX_PID 2>/dev/null
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# 捕获系统信号
|
|
||||||
trap 'graceful_shutdown' SIGTERM SIGINT
|
|
||||||
|
|
||||||
# 启动 Nginx(前台运行)
|
|
||||||
echo "启动 Nginx..."
|
|
||||||
nginx -g "daemon off;" &
|
|
||||||
NGINX_PID=$!
|
|
||||||
|
|
||||||
# 等待所有后台进程
|
|
||||||
wait $BACKEND_PID $NGINX_PID
|
|
||||||
@@ -104,10 +104,6 @@ func (m *meta) Start(ctx context.Context) {
|
|||||||
ticker := time.NewTicker(time.Minute)
|
ticker := time.NewTicker(time.Minute)
|
||||||
m.ctx = ctx
|
m.ctx = ctx
|
||||||
|
|
||||||
if err := os.MkdirAll(opt.Cfg.DataPath, 0644); err != nil {
|
|
||||||
log.Fatal("controller.MetaManager.Start: mkdir datapath failed, path = %s, err = %s", opt.Cfg.DataPath, err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清理 2 分钟内没有继续上传的 part
|
// 清理 2 分钟内没有继续上传的 part
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user