fix: add vscode-server dir to Dockerfile, use vscode event for SSH

This commit is contained in:
shuiyu1123 committed 2026-06-18 20:18:20 +00:00
1 parent c6ff7be55a
commit 7b47faac50
2 files changed
+28 -17

No files matched your search

+21 -14
View File
@@ -1,14 +1,21 @@
version: "3"
tasks:
- name: "训练小狸AI-Epoch100"
image:
dockerfile: .ide/Dockerfile
resources:
cpu: 8
memory: 32G
gpu: 1
env:
CUDA_VISIBLE_DEVICES: "0"
PYTHONUNBUFFERED: "1"
commands:
- cd /workspace && nvidia-smi && echo "=== GPU就绪 ===" && python3 scripts/train_cnb.py --epochs 100 --batch_size 16
$:
vscode:
- docker:
build: .ide/Dockerfile
runner:
cpus: 8
tags: cnb:arch:amd64:gpu
services:
- vscode
- docker
env:
CUDA_VISIBLE_DEVICES: "0"
PYTHONUNBUFFERED: "1"
stages:
- name: 开始训练
script: |
cd /workspace
nvidia-smi
echo "=== GPU就绪,开始训练 ==="
python3 scripts/train_cnb.py --epochs 100 --batch_size 16
echo "=== 训练完成 ==="
+7 -3
View File
@@ -1,11 +1,15 @@
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime
# 基础工具
RUN apt-get update && apt-get install -y git curl wget nano && rm -rf /var/lib/apt/lists/*
# 安装必要工具
RUN apt-get update && apt-get install -y git curl wget nano openssh-server \
&& rm -rf /var/lib/apt/lists/*
# tqdm用于进度条
# pip依赖
RUN pip install --no-cache-dir tqdm numpy requests
# 创建 vscode-server 需要的目录
RUN mkdir -p /root/.vscode-server /root/.vscode-server/data/Machine
# 设置工作目录
WORKDIR /workspace