diff --git a/.codebuddy/skills/docker-build/SKILL.md b/.codebuddy/skills/docker-build/SKILL.md new file mode 100644 index 0000000..7a7b08e --- /dev/null +++ b/.codebuddy/skills/docker-build/SKILL.md @@ -0,0 +1,37 @@ +--- +name: docker-build +description: 根据dockerfile构建镜像 +--- + +# Docker Build + +## Overview + +此技能用于协助完成 Docker 镜像的构建 + +## When to Use + +根据docker file 构建镜像 + +## Core Workflow + +### 1. 清理node1 服务器 ~/dockerbuild/ 目录下,对应项目的文件 + + + +### 2. 同步代码到node1 服务器 ~/dockerbuild/ 目录下,对应项目的文件 + + + +### 3. 执行docker build 构建镜像 + +### 4. 导出镜像,并下载到当前项目对应的把目录下 + +## node1服务器信息 + ip 10.0.3.5 + 用户名 awei + 已做ssh 互信 +## 镜像命名 +- 名字保持和对应目录名称一致 +- 版本采用月日时分格式,如 04192334(4月19日23时34分) + diff --git a/.workbuddy/memory/MEMORY.md b/.workbuddy/memory/MEMORY.md deleted file mode 100644 index 394ada5..0000000 --- a/.workbuddy/memory/MEMORY.md +++ /dev/null @@ -1,55 +0,0 @@ -# MEMORY.md - -## 服务器信息 - -### node1 -- **IP**: 10.0.3.5 -- **用户名**: awei -- **SSH 互信**: 已配置 - -## Docker 镜像构建流程 - -### 关键步骤 - -1. **清理服务端目录**(避免文件残留导致问题) - ```bash - ssh awei@10.0.3.5 "rm -rf /tmp/<目录名> && mkdir -p /tmp/<目录名>" - ``` - -2. **上传源码文件** - ```bash - scp <本地文件> awei@10.0.3.5:/tmp/<目录名>/ - ``` - -3. **构建镜像**(带版本号) - ```bash - ssh awei@10.0.3.5 "cd /tmp/<目录名> && docker build -t stonelan/<镜像名>:YYYYMMDD -t stonelan/<镜像名>:latest ." - ``` - -4. **导出镜像** - ```bash - ssh awei@10.0.3.5 "docker save -o /tmp/<镜像名>-YYYYMMDD.tar stonelan/<镜像名>:YYYYMMDD" - ``` - -5. **下载到本地** - ```bash - scp awei@10.0.3.5:/tmp/<镜像名>-YYYYMMDD.tar <本地路径>/ - ``` - -### 现有镜像 - -| 镜像名称 | 版本号 | 基础镜像 | 说明 | -|---------|--------|---------|------| -| stonelan/nginx | 1.0.1 | nginx:alpine | 反向代理,含自定义配置 | -| stonelan/frpc | 1.0.1 | alpine:3.19 | FRP 客户端 v0.61.1 | - -### 注意事项 - -- **版本号格式**:语义化版本 `X.Y.Z`(如 1.0.0、1.0.1、1.1.0) -- **每次构建必须递增版本号**,避免重复 -- 构建前先清理服务端临时目录,避免旧文件干扰 -- 本地 tar.gz 等二进制文件通过 scp 传输正常,无需特殊处理 - -### 已知问题 - -- **scp 传输速度慢**:Windows OpenSSH 客户端传输速度约 0.76 MB/s(12MB 文件需 2-3 分钟),暂无解决方案 diff --git a/nginx/Dockerfile b/nginx/Dockerfile index d0dcc9c..d925647 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -10,6 +10,9 @@ LABEL description="Nginx reverse proxy container" COPY nginx.conf /etc/nginx/nginx.conf COPY conf.d /etc/nginx/conf.d +# 复制静态文件 +COPY html /usr/share/nginx/html + # 创建必要的目录 RUN mkdir -p /var/log/nginx && \ mkdir -p /etc/nginx/ssl && \ diff --git a/nginx/conf.d/gitea.conf b/nginx/conf.d/gitea.conf index dba7865..ffca386 100644 --- a/nginx/conf.d/gitea.conf +++ b/nginx/conf.d/gitea.conf @@ -1,6 +1,6 @@ server { listen 80; - server_name gitea.membank.xyz; + server_name gitea.stonelan.cn; client_max_body_size 200m; location / { proxy_pass http://gitea:3000; diff --git a/nginx/conf.d/membank-xyz.conf b/nginx/conf.d/membank-xyz.conf new file mode 100644 index 0000000..26e016c --- /dev/null +++ b/nginx/conf.d/membank-xyz.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name membank.xyz; + + root /usr/share/nginx/html/membank; + index index.html; + + location / { + try_files $uri $uri/ =404; + } +} diff --git a/nginx/conf.d/oneapi.conf b/nginx/conf.d/oneapi.conf new file mode 100644 index 0000000..d88a019 --- /dev/null +++ b/nginx/conf.d/oneapi.conf @@ -0,0 +1,38 @@ +server { + listen 80; + server_name oneapi.membank.xyz; + + location / { + proxy_pass http://oneapi:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # 添加代理超时配置 + proxy_connect_timeout 60s; + proxy_read_timeout 600s; + proxy_send_timeout 600s; + + # 支持大文件上传和API请求 + client_max_body_size 100M; + proxy_buffering off; + + # 启用gzip压缩 + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_proxied any; + gzip_comp_level 6; + gzip_types + text/plain + text/css + text/xml + text/javascript + application/json + application/javascript + application/xml+rss + application/atom+xml + image/svg+xml; + } +} \ No newline at end of file diff --git a/nginx/conf.d/sy.conf b/nginx/conf.d/sy.conf new file mode 100644 index 0000000..392b69d --- /dev/null +++ b/nginx/conf.d/sy.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name sy.membank.xyz; + + location / { + proxy_pass http://10.0.3.148:6806; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # WebSocket 支持 + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # 添加代理超时配置 + proxy_connect_timeout 60s; + proxy_read_timeout 600s; + proxy_send_timeout 600s; + } +} diff --git a/nginx/conf.d/v.conf b/nginx/conf.d/v.conf new file mode 100644 index 0000000..11e655b --- /dev/null +++ b/nginx/conf.d/v.conf @@ -0,0 +1,18 @@ +server { + listen 80; + server_name v.membank.xyz; + + location / { + root /usr/share/nginx/html/v; + index index.html index.htm; + + # 启用目录浏览(可选) + autoindex on; + + # 添加缓存配置 + location ~* \.(html|css|js|png|jpg|jpeg|gif|ico|svg)$ { + expires 1d; + add_header Cache-Control "public, immutable"; + } + } +} diff --git a/nginx/html/membank/verification.html b/nginx/html/membank/verification.html new file mode 100644 index 0000000..5d7e0ec --- /dev/null +++ b/nginx/html/membank/verification.html @@ -0,0 +1 @@ +verify_01965aad87b3aae1c15f4373ae9efcfb \ No newline at end of file diff --git a/nginx/html/v/verification.html b/nginx/html/v/verification.html new file mode 100644 index 0000000..5d7e0ec --- /dev/null +++ b/nginx/html/v/verification.html @@ -0,0 +1 @@ +verify_01965aad87b3aae1c15f4373ae9efcfb \ No newline at end of file diff --git a/nginx/nginx-08200145.tar b/nginx/nginx-08200145.tar new file mode 100644 index 0000000..561d3b8 Binary files /dev/null and b/nginx/nginx-08200145.tar differ diff --git a/nginx/nginx.tar b/nginx/nginx.tar new file mode 100644 index 0000000..e6df145 Binary files /dev/null and b/nginx/nginx.tar differ diff --git a/nginx/verification.html b/nginx/verification.html new file mode 100644 index 0000000..5d7e0ec --- /dev/null +++ b/nginx/verification.html @@ -0,0 +1 @@ +verify_01965aad87b3aae1c15f4373ae9efcfb \ No newline at end of file diff --git a/oneapi/docker-compose.yml b/oneapi/docker-compose.yml new file mode 100644 index 0000000..764b785 --- /dev/null +++ b/oneapi/docker-compose.yml @@ -0,0 +1,62 @@ +services: + mysql: + image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/mysql:8.0 + container_name: mysql + environment: + - TZ=Asia/Shanghai + - MYSQL_ROOT_PASSWORD=oneapi_root_pass + - MYSQL_DATABASE=oneapi + - MYSQL_USER=oneapi + - MYSQL_PASSWORD=oneapi_pass + restart: always + volumes: + - ./mysql/data:/var/lib/mysql + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3307:3306" + networks: + - trim-default + command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + + redis: + image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/redis:7-alpine + container_name: redis + environment: + - TZ=Asia/Shanghai + restart: always + volumes: + - ./redis/data:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "6380:6379" + networks: + - trim-default + command: redis-server --appendonly yes + + oneapi: + image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/songquanpeng/one-api:v0.6.7 + container_name: oneapi + environment: + - TZ=Asia/Shanghai + - SESSION_SECRET=change_this_to_your_secret_key + - SQL_DSN=oneapi:oneapi_pass@tcp(mysql:3306)/oneapi?charset=utf8mb4&parseTime=true + - REDIS_CONN_STRING=redis://redis:6379/0 + - MEMORY_CACHE=1 + restart: always + volumes: + - ./data:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3003:3000" + networks: + - trim-default + depends_on: + - mysql + - redis + +networks: + trim-default: + external: true