Skip to content

Commit 4214d25

Browse files
committed
add ai-goofish-monitor image
1 parent 4f34803 commit 4214d25

4 files changed

Lines changed: 261 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
This is a Docker release repository that builds and publishes Docker images for various services to multiple registries (Docker Hub, GitHub Container Registry, and AliCloud Container Registry). The repository contains a monorepo structure with each service having its own directory under `./Docker/`.
8+
9+
## Architecture
10+
11+
- **Docker Images**: Each service has its own directory under `./Docker/` containing a Dockerfile and associated files
12+
- **GitHub Actions**: Automated CI/CD workflows for building and publishing images
13+
- **Multi-Platform Support**: Images are built for multiple architectures (amd64, arm64, arm/v7, etc.)
14+
- **Multi-Registry Publishing**: Images are published to Docker Hub, GHCR, and AliCloud registries
15+
16+
## Common Development Commands
17+
18+
### Building Images Locally
19+
20+
To build any Docker image locally:
21+
22+
```bash
23+
# Navigate to the service directory
24+
cd ./Docker/[service-name]
25+
26+
# Build the image
27+
docker build -t [service-name]:latest .
28+
```
29+
30+
### Testing Images
31+
32+
Most services include docker-compose.yml files for local testing:
33+
34+
```bash
35+
# Navigate to service directory
36+
cd ./Docker/[service-name]
37+
38+
# Start with docker-compose
39+
docker-compose up -d
40+
41+
# View logs
42+
docker-compose logs -f
43+
44+
# Stop services
45+
docker-compose down
46+
```
47+
48+
### GitHub Actions Workflows
49+
50+
The repository uses several GitHub Actions workflows:
51+
52+
- **release.yml**: Main workflow for building and publishing Docker images
53+
- **dispatch-*.yml**: Workflows for specific service releases
54+
- **schedule-watch-offical.yml**: Scheduled workflow to watch for upstream updates
55+
- **check-offical-release.yml**: Workflow to check for new official releases
56+
57+
### Service-Specific Operations
58+
59+
Each service directory contains:
60+
- `Dockerfile`: Container build instructions
61+
- `README.md`: Service-specific documentation and deployment instructions
62+
- `docker-compose.yml` (optional): Local testing configuration
63+
- `entrypoint.sh` (optional): Custom container entrypoint scripts
64+
65+
## Working with Services
66+
67+
### Adding New Services
68+
69+
1. Create a new directory under `./Docker/[service-name]`
70+
2. Add a Dockerfile following the repository's conventions
71+
3. Add a README.md with deployment instructions
72+
4. Update the main README.md to include the new service
73+
5. Create a dispatch workflow if needed
74+
75+
### Updating Existing Services
76+
77+
1. Modify the Dockerfile or related files in the service directory
78+
2. Test locally using docker-compose if available
79+
3. Update README.md if necessary
80+
4. The automated workflows will handle building and publishing
81+
82+
## Key Files and Directories
83+
84+
- `./Docker/`: Contains all service directories
85+
- `.github/workflows/`: CI/CD workflows
86+
- `README.md`: Main repository documentation with service list and deployment examples
87+
88+
## Build Args and Environment Variables
89+
90+
The build system automatically injects these build args:
91+
- `BUILD_DATE`: Build timestamp
92+
- `VCS_REF`: Git commit SHA
93+
- `VERSION`: Image version (inferred from tag when not "latest")
94+
95+
Additional build args can be specified through workflow inputs.
96+
97+
## Multi-Registry Support
98+
99+
Images are automatically tagged and published to:
100+
- Docker Hub: `funnyzak/[service-name]:[tag]`
101+
- GitHub Container Registry: `ghcr.io/funnyzak/[service-name]:[tag]`
102+
- AliCloud Container Registry: `registry.cn-beijing.aliyuncs.com/funnyzak/[service-name]:[tag]`
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
FROM alpine:3.22 AS repo-clone
2+
3+
ARG VERSION
4+
5+
WORKDIR /app
6+
7+
RUN apk add --no-cache git
8+
9+
WORKDIR /app
10+
11+
RUN git clone https://github.com/Usagi-org/ai-goofish-monitor.git . \
12+
&& git checkout ${VERSION} || git checkout $(git remote show origin | awk '/HEAD branch/ {print $NF}') \
13+
&& echo ${VERSION:-$(git rev-parse HEAD)} > VERSION
14+
15+
# Multi-stage build for optimized AI Goofish Monitor Docker image
16+
FROM python:3.11-slim-bookworm AS builder
17+
18+
# Set environment variables to prevent interactive prompts
19+
ENV DEBIAN_FRONTEND=noninteractive
20+
21+
# Create virtual environment
22+
ENV VIRTUAL_ENV=/opt/venv
23+
RUN python3 -m venv $VIRTUAL_ENV
24+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
25+
26+
# Install Python dependencies to virtual environment (using Chinese mirror for speed)
27+
COPY --from=repo-clone /app/requirements.txt .
28+
29+
RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
30+
31+
# Only download Playwright's Chromium browser, system dependencies will be installed in next stage
32+
RUN playwright install chromium
33+
34+
# Stage 2: Create the final, lean image
35+
FROM python:3.11-slim-bookworm
36+
37+
ARG VERSION
38+
ARG BUILD_DATE
39+
ARG VCS_REF
40+
41+
LABEL org.label-schema.name="ai-goofish-monitor" \
42+
org.label-schema.description="ai-goofish-monitor" \
43+
org.label-schema.version="${VERSION}" \
44+
org.label-schema.vcs-ref="${VCS_REF}" \
45+
org.label-schema.build-date="${BUILD_DATE}" \
46+
org.label-schema.vendor="Leon<silenceace@gmail.com>" \
47+
org.label-schema.url="https://github.com/funnyzak/docker-release"
48+
49+
# Set working directory and environment variables
50+
WORKDIR /app
51+
ENV VIRTUAL_ENV=/opt/venv
52+
ENV PATH="/opt/venv/bin:$PATH"
53+
ENV PYTHONUNBUFFERED=1
54+
55+
# New environment variable to distinguish Docker environment from local environment
56+
ENV RUNNING_IN_DOCKER=true
57+
58+
# Tell Playwright where to find the browser
59+
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
60+
61+
# Copy virtual environment from builder stage, so we can use playwright commands
62+
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
63+
64+
# Install all system-level dependencies required to run the browser (including libzbar0) and network diagnostic tools
65+
RUN apt-get update \
66+
&& apt-get install -y --no-install-recommends \
67+
libzbar0 \
68+
curl \
69+
wget \
70+
iputils-ping \
71+
dnsutils \
72+
iproute2 \
73+
netcat-openbsd \
74+
telnet \
75+
&& playwright install-deps chromium \
76+
&& apt-get clean \
77+
&& rm -rf /var/lib/apt/lists/*
78+
79+
# Copy pre-downloaded browser from builder stage
80+
COPY --from=builder /root/.cache/ms-playwright /root/.cache/ms-playwright
81+
82+
# Copy application code
83+
# .dockerignore file will handle exclusions
84+
COPY --from=repo-clone /app .
85+
86+
# Declare the service running port
87+
EXPOSE 8000
88+
89+
# Command executed when the container starts
90+
CMD ["python", "web_server.py"]
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
version: '3.8'
2+
3+
services:
4+
ai-goofish-monitor:
5+
image: funnyzak/ai-goofish-monitor:latest
6+
container_name: ai-goofish-monitor
7+
restart: unless-stopped
8+
environment:
9+
# AI Configuration
10+
- OPENAI_API_KEY=${OPENAI_API_KEY}
11+
- OPENAI_BASE_URL=${OPENAI_BASE_URL}
12+
- OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME}
13+
14+
# Optional: Proxy Configuration
15+
- PROXY_URL=${PROXY_URL:-}
16+
17+
# Optional: Notification Services
18+
- NTFY_TOPIC_URL=${NTFY_TOPIC_URL:-}
19+
- GOTIFY_URL=${GOTIFY_URL:-}
20+
- GOTIFY_TOKEN=${GOTIFY_TOKEN:-}
21+
- BARK_URL=${BARK_URL:-}
22+
- WX_BOT_URL=${WX_BOT_URL:-}
23+
- WEBHOOK_URL=${WEBHOOK_URL:-}
24+
- WEBHOOK_METHOD=${WEBHOOK_METHOD:-POST}
25+
- WEBHOOK_HEADERS=${WEBHOOK_HEADERS:-}
26+
- WEBHOOK_CONTENT_TYPE=${WEBHOOK_CONTENT_TYPE:-JSON}
27+
- WEBHOOK_QUERY_PARAMETERS=${WEBHOOK_QUERY_PARAMETERS:-}
28+
- WEBHOOK_BODY=${WEBHOOK_BODY:-}
29+
30+
# Browser Configuration
31+
- LOGIN_IS_EDGE=${LOGIN_IS_EDGE:-false}
32+
- RUN_HEADLESS=${RUN_HEADLESS:-true}
33+
34+
# AI Configuration
35+
- AI_DEBUG_MODE=${AI_DEBUG_MODE:-false}
36+
- SKIP_AI_ANALYSIS=${SKIP_AI_ANALYSIS:-false}
37+
- ENABLE_THINKING=${ENABLE_THINKING:-false}
38+
39+
# Web UI Configuration
40+
- SERVER_PORT=${SERVER_PORT:-8000}
41+
- WEB_USERNAME=${WEB_USERNAME:-admin}
42+
- WEB_PASSWORD=${WEB_PASSWORD:-admin123}
43+
44+
# Docker Environment
45+
- RUNNING_IN_DOCKER=true
46+
- TZ=Asia/Shanghai
47+
48+
ports:
49+
- "${SERVER_PORT:-8000}:8000"
50+
51+
volumes:
52+
# Mount configuration files
53+
- ./config.json:/app/config.json:ro
54+
- ./.env:/app/.env:ro
55+
56+
# Mount data directory for persistent storage
57+
- ./data:/app/data
58+
59+
# Mount login state file (must be provided after initial setup)
60+
- ./xianyu_state.json:/app/xianyu_state.json:ro
61+
62+
healthcheck:
63+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
64+
interval: 30s
65+
timeout: 10s
66+
retries: 3
67+
start_period: 40s

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The following images are available:
3232
- [**Dify2OpenAI**](https://github.com/funnyzak/docker-release/tree/main/Docker/dify2openai): `funnyzak/dify2openai:latest` ([Docker Hub](https://hub.docker.com/r/funnyzak/dify2openai))
3333
- [**Certimate**](https://github.com/funnyzak/docker-release/tree/main/Docker/certimate): `funnyzak/certimate:latest` ([Docker Hub](https://hub.docker.com/r/funnyzak/certimate))
3434
- [**Watermark**](https://github.com/funnyzak/docker-release/tree/main/Docker/watermark) `funnyzak/watermark:latest` ([Docker Hub](https://hub.docker.com/r/funnyzak/watermark))
35+
- [**AI Goofish Monitor**](https://github.com/funnyzak/docker-release/tree/main/Docker/ai-goofish-monitor): `funnyzak/ai-goofish-monitor:latest` ([Docker Hub](https://hub.docker.com/r/funnyzak/ai-goofish-monitor))
3536
- [**Hello**](https://github.com/funnyzak/docker-release/tree/main/Docker/hello): `funnyzak/hello:latest` ([Docker Hub](https://hub.docker.com/r/funnyzak/hello))
3637

3738
### Docker Pull
@@ -66,6 +67,7 @@ You can pull the above images from Docker Hub, GitHub Container Registry, or Ali
6667
| [Dify2OpenAI](https://github.com/funnyzak/docker-release/tree/main/Docker/dify2openai/README.md) | [![Docker Tag](https://img.shields.io/docker/v/funnyzak/dify2openai?sort=semver&style=flat-square)](https://hub.docker.com/r/funnyzak/dify2openai) | [![Docker Image Size](https://img.shields.io/docker/image-size/funnyzak/dify2openai)](https://hub.docker.com/r/funnyzak/dify2openai) | [![Docker Pulls](https://img.shields.io/docker/pulls/funnyzak/dify2openai.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/dify2openai) |
6768
| [Certimate](https://github.com/funnyzak/docker-release/tree/main/Docker/certimate/README.md) | [![Docker Tag](https://img.shields.io/docker/v/funnyzak/certimate?sort=semver&style=flat-square)](https://hub.docker.com/r/funnyzak/certimate) | [![Docker Image Size](https://img.shields.io/docker/image-size/funnyzak/certimate)](https://hub.docker.com/r/funnyzak/certimate) | [![Docker Pulls](https://img.shields.io/docker/pulls/funnyzak/certimate.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/certimate) |
6869
| [Watermark](https://github.com/funnyzak/docker-release/tree/main/Docker/watermark/README.md) | [![Docker Tag](https://img.shields.io/docker/v/funnyzak/watermark?sort=semver&style=flat-square)](https://hub.docker.com/r/funnyzak/watermark) | [![Docker Image Size](https://img.shields.io/docker/image-size/funnyzak/watermark)](https://hub.docker.com/r/funnyzak/watermark) | [![Docker Pulls](https://img.shields.io/docker/pulls/funnyzak/watermark.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/watermark) |
70+
| [AI Goofish Monitor](https://github.com/funnyzak/docker-release/tree/main/Docker/ai-goofish-monitor/README.md) | [![Docker Tag](https://img.shields.io/docker/v/funnyzak/ai-goofish-monitor?sort=semver&style=flat-square)](https://hub.docker.com/r/funnyzak/ai-goofish-monitor) | [![Docker Image Size](https://img.shields.io/docker/image-size/funnyzak/ai-goofish-monitor)](https://hub.docker.com/r/funnyzak/ai-goofish-monitor) | [![Docker Pulls](https://img.shields.io/docker/pulls/funnyzak/ai-goofish-monitor.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/ai-goofish-monitor) |
6971
| [Hello](https://github.com/funnyzak/docker-release/tree/main/Docker/hello/README.md) | [![Docker Tag](https://img.shields.io/docker/v/funnyzak/hello?sort=semver&style=flat-square)](https://hub.docker.com/r/funnyzak/hello) | [![Docker Image Size](https://img.shields.io/docker/image-size/funnyzak/hello)](https://hub.docker.com/r/funnyzak/hello) | [![Docker Pulls](https://img.shields.io/docker/pulls/funnyzak/hello.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/hello) |
7072

7173
## Services

0 commit comments

Comments
 (0)