From d462263b39215ea0dc46549c5a934b468657b4cb Mon Sep 17 00:00:00 2001 From: panjunlan Date: Sat, 21 Feb 2026 15:00:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E8=BF=91=E5=AE=8C=E5=96=84=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=BE=85=E7=94=9F=E4=BA=A7=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=B5=8B=E8=AF=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | Bin 0 -> 174 bytes 2 files changed, 51 insertions(+) create mode 100644 requirements.txt diff --git a/README.md b/README.md index 22e1adf..ea00b49 100644 --- a/README.md +++ b/README.md @@ -398,9 +398,60 @@ pip install -r requirements.txt ## 构建 Docker 镜像 +### 安装 Docker +``` shell +sudo curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker.repo +sudo dnf install docker-ce -y && docker -v +sudo systemctl enable --now docker && systemctl status docker +``` +### 下载并解压代码文件 +``` shell +wget https://gitcode.junlan.site/junlan/RemoveWeeklyShapshot/archive/Dev.zip && unzip Dev.zip && cd removeweeklyshapshot/ +``` +### 构建 Dockerfile 文件 +``` dockerfile +cat << 'EOF' > Dockerfile +FROM python:3.14.3-slim +# 切换目录 +WORKDIR /removeweeklysnapshot/ +# 复制代码 +COPY ./ /removeweeklysnapshot/ +# 安装必要的软件和 python 库 +RUN apt-get update && apt-get install procps tzdata -y && pip install -r requirements.txt +# 配置时区 +ENV TZ=Asia/Shanghai +RUN ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && dpkg-reconfigure -f noninteractive tzdata +# 容器内执行启动程序 +CMD ["/removeweeklysnapshot/main.py"] +EOF +``` + +### 执行构建 Docker 镜像 + +``` shell +sudo docker build --no-cache -t removeweeklysnapshot . +``` + +### 构建 Compose 文件 + +``` yaml +services: + move_ix_file: + container_name: removeweeklysnapshot + image: removeweeklysnapshot + restart: always + stdin_open: true + tty: true +``` + +### 运行容器 + +``` shell +docker compose up -d +``` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8f6ff6dc0c6715f6e3b8793904a0577c02781850 GIT binary patch literal 174 zcmX}k!3u&v6ouh`9rP+PDhMrH%w9oo)iP5s$P`1-mru`(6_>epalSd*$5K#or=_80 z;;B25YGMLHO+dt%6Fq~nm-fmc_cM`%p^|iJ;3iXRzyHGcrXyXM>D1Nn@cG66b`9=1 PQ>g!nB`5PD`HGkw?Asa6 literal 0 HcmV?d00001