Skip to content

Commit

Permalink
feat: 自动点赞的docker
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Sep 13, 2024
1 parent a0dbf03 commit d4b7195
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ RUN_TIME_LIMIT_MINUTES=15
# 电报通知报错信息(可不填)
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
# 自动点赞用户id(只有在cron_bypassCF_likeUser有用)
# 自动点赞用户id(只有在cron_bypassCF_likeUser有用,也就是自动点赞特定用户的时候有用)
SPECIFIC_USER=14790897
14 changes: 11 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: AutoRead Docker Image Push(勿动)
name: AutoRead Docker Image Push (勿动)

on:
push:
branches:
- main
# 这里其实可以使用Windows环境,这样就不需要考虑Linux

jobs:
build-and-push:
runs-on: ubuntu-latest
Expand All @@ -19,10 +19,18 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and Push Image
- name: Build and Push auto-read
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: 14790897/auto-read:latest

- name: Build and Push auto-like-user
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile-like-user
push: true
tags: 14790897/auto-like-user:latest
65 changes: 65 additions & 0 deletions Dockerfile-like-user
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 使用官方 Node.js 作为父镜像
FROM node:22-slim

# 设置工作目录
WORKDIR /app

# 复制 package.json 和 package-lock.json (如果存在)
COPY package*.json ./

# 安装 Puppeteer 依赖
RUN apt update && apt install -y \
cron\
wget \
ca-certificates \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
xdg-utils \
--no-install-recommends \
xvfb \
&& rm -rf /var/lib/apt/lists/*

#时区为中国
ENV TZ=Asia/Shanghai

# 安装 Node.js 依赖
RUN npm install

# 将根目录复制到容器中
COPY . .

# 设置容器启动时运行的命令
CMD ["node", "/app/bypasscf_likeUser.js"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ node .\bypasscf_likeUser.js
克隆仓库,在`docker-compose.yml`里面设置环境变量,然后运行

```sh
# 自动阅读随机点赞
docker-compose up -d
# 自动点赞特定用户
docker-compose -f docker-compose-like-user.yml up -d
```

查看日志
Expand Down
7 changes: 7 additions & 0 deletions docker-compose-like-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
autolikeuser:
image: 14790897/auto-like-user:latest
container_name: auto-like-user
env_file:
- ./.env
restart: unless-stopped # 容器退出时重启策略

0 comments on commit d4b7195

Please sign in to comment.