From 49df2ec9528c41f3a9d2f669d245c6b76d905be7 Mon Sep 17 00:00:00 2001 From: zzw <1464003642@qq.com> Date: Tue, 18 Aug 2026 17:31:17 +0800 Subject: [PATCH] feat: .gitignore & deploy file --- .gitea/workflows/ci.yml | 31 ++++++++++++++++++++++++ .gitignore | 4 +++ Dockerfile | 13 ++++------ __pycache__/train_yolov8.cpython-39.pyc | Bin 1546 -> 0 bytes data.yaml | 6 ++--- docker-compose.prod.yml | 16 ++++++++++++ 6 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitignore delete mode 100644 __pycache__/train_yolov8.cpython-39.pyc create mode 100644 docker-compose.prod.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..729e770 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: + - develop + workflow_dispatch: + +jobs: + docker: + runs-on: runner + env: + NAME: lone/xunlian + steps: + - name: Checkout + uses: https://git.ailuowan.com/deploy/checkout@v4 + + - name: Login Registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ vars.REGISTRY }} -u "${{ vars.REGISTRY_USERNAME }}" --password-stdin + + - name: Docker build + run: | + docker buildx build --load \ + -f Dockerfile \ + -t ${{ vars.REGISTRY }}/$NAME:latest \ + . + + - name: Docker push + run: | + docker push ${{ vars.REGISTRY }}/$NAME:latest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec45b4a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pt +__pycache__/ + +runs/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3cc99f2..1fcd407 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ -# YOLOv8 training environment (NVIDIA GPU) +# YOLOv8 training image (NVIDIA GPU) # -# The image contains Python, PyTorch and Ultralytics only. The project -# directory (including data.yaml, train/valid/test and *.pt files) is mounted -# at /workspace when the container is started; this keeps the image small. +# Image contains Python / PyTorch / Ultralytics + train script. +# Dataset (*.pt weights, /data/facepp, runs/) are mounted at runtime. FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04 @@ -22,11 +21,10 @@ RUN apt-get update \ libxext6 \ libxrender1 \ python3 \ - python3-dev \ python3-pip \ && rm -rf /var/lib/apt/lists/* -# PyTorch 2.5.1 is paired with torchvision 0.20.1 and CUDA 12.4. +# PyTorch 2.5.1 + torchvision 0.20.1 (CUDA 12.4) RUN python3 -m pip install --upgrade pip \ && python3 -m pip install \ torch==2.5.1 \ @@ -36,8 +34,7 @@ RUN python3 -m pip install --upgrade pip \ WORKDIR /workspace -# These files make the image usable for a quick smoke test. The normal run -# command mounts the whole project over /workspace. COPY train_yolov8.py data.yaml ./ ENTRYPOINT ["python3", "train_yolov8.py"] +CMD ["--model", "yolov8n.pt", "--device", "0"] diff --git a/__pycache__/train_yolov8.cpython-39.pyc b/__pycache__/train_yolov8.cpython-39.pyc deleted file mode 100644 index 4cdd1d1b9db957925624392945127ad78774a90c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1546 zcmY*ZOK;pZ5GM6rdA+vdyllsg4mngnv`BLbiXv#5)Th=7+T>7O1V!X}W$Oi!>%hVq zDB@oI3yK0sZ~aTW_T+1iJ#~h=F18Y8G&3BM!*4z+UtbRiJcrNcCqs{rztCBIEO5R7 zk%yodVYDJOO({j&s;t^hZDZS&Q@g1Pw!_?CN$N3=`SA65z=Bgte9Qey0;7YUNE}|n zS|p}=^gu`!j)q9vt=iZ$(}<5gzC4S=2U>nwBzRxymJ1yd-Jzny16%!Lz(*cuW_S!&ZVzV2Tc)f{KKFG?s>)&e-g0``TuMv>|nO2YuufS zEr|Lc@-8SsL%M0+Tg&eVz9#2?^u<$ef*AUK1VfQaazPYT)+I%{oH!SBP8r=J7uMYR z8(S^IBL})mi?U&tq_R2cFmIsQuJ5Y&(kt)U%^g1vzL3pB@x&j0`b diff --git a/data.yaml b/data.yaml index 4cd9956..62f1337 100644 --- a/data.yaml +++ b/data.yaml @@ -1,7 +1,7 @@ path: . -train: train/images -val: valid/images -test: test/images +train: /data/facepp/train/images +val: /data/facepp/valid/images +test: /data/facepp/test/images nc: 11 names: ['0', '1', '10', '2', '3', '4', '5', '6', '7', '8', '9'] diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..d78456a --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,16 @@ +services: + xunlian: + image: git.ailuowan.com/lone/xunlian:latest + gpus: all + volumes: + - ./yolov8n.pt:/workspace/yolov8n.pt:ro + - ./yolov8m.pt:/workspace/yolov8m.pt:ro + - ./yolo26n.pt:/workspace/yolo26n.pt:ro + - /data/facepp:/data/facepp:ro + + - ./runs:/workspace/runs + environment: + TZ: Asia/Shanghai + NVIDIA_VISIBLE_DEVICES: all + NVIDIA_DRIVER_CAPABILITIES: compute,utility + restart: "no"