mirror of
https://github.com/nickrunning/wechat-selkies.git
synced 2026-05-09 00:24:09 +00:00
feat: support minimal image variant with WeChat only (#92)
Add INSTALL_QQ and INSTALL_PCMANFM build args to conditionally skip QQ and file manager installation. CI builds both :latest (full) and :minimal (WeChat only) tags for each release.
This commit is contained in:
56
.github/workflows/docker.yml
vendored
56
.github/workflows/docker.yml
vendored
@@ -70,6 +70,37 @@ jobs:
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Extract metadata for minimal image
|
||||
id: meta-minimal
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/${{ github.repository }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }},enable=${{ vars.ENABLE_DOCKERHUB == 'true' }}
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=-minimal
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=raw,value=minimal,enable=${{ github.ref == format('refs/heads/{0}', 'master') || startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
- name: Build and push minimal Docker image
|
||||
id: build-minimal
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta-minimal.outputs.tags }}
|
||||
labels: ${{ steps.meta-minimal.outputs.labels }}
|
||||
build-args: |
|
||||
INSTALL_QQ=false
|
||||
INSTALL_PCMANFM=false
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Generate artifact attestation
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
uses: actions/attest-build-provenance@v1
|
||||
@@ -84,11 +115,16 @@ jobs:
|
||||
echo "### GitHub Container Registry" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Registry:** ${{ env.REGISTRY }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Repository:** ${{ env.IMAGE_NAME }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Digest:** \`${{ steps.build-image.outputs.digest }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Full image digest:** \`${{ steps.build-image.outputs.digest }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Minimal image digest:** \`${{ steps.build-minimal.outputs.digest }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Tags (full):**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Tags (minimal):**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "${{ steps.meta-minimal.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
if [ "${{ vars.ENABLE_DOCKERHUB }}" == "true" ]; then
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -115,6 +151,7 @@ jobs:
|
||||
body: |
|
||||
## 🐳 Docker Images
|
||||
|
||||
### Full (WeChat + QQ + File Manager)
|
||||
**GitHub Container Registry:**
|
||||
```bash
|
||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
|
||||
@@ -127,17 +164,20 @@ jobs:
|
||||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
|
||||
```
|
||||
|
||||
## 🚀 Quick Start
|
||||
**GitHub Container Registry:**
|
||||
### Minimal (WeChat only)
|
||||
```bash
|
||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:minimal
|
||||
```
|
||||
|
||||
## 🚀 Quick Start
|
||||
**Full:**
|
||||
```bash
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
```
|
||||
|
||||
**Docker Hub** (if enabled):
|
||||
**Minimal:**
|
||||
```bash
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ steps.meta.outputs.version }}
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:minimal
|
||||
```
|
||||
|
||||
Then visit: https://localhost:3001
|
||||
53
Dockerfile
53
Dockerfile
@@ -13,9 +13,10 @@ LABEL org.opencontainers.image.licenses="GPL-3.0-only"
|
||||
# Build arguments for multi-arch support
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
ARG INSTALL_QQ=true
|
||||
ARG INSTALL_PCMANFM=true
|
||||
RUN echo "🏗️ Building WeChat-Selkies on $BUILDPLATFORM, targeting $TARGETPLATFORM"
|
||||
|
||||
# set environment variables
|
||||
RUN apt-get update && \
|
||||
apt-get install -y fonts-noto-cjk libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
|
||||
libxcb-render-util0 libxcb-xkb1 libxkbcommon-x11-0 \
|
||||
@@ -27,8 +28,12 @@ RUN apt-get update && \
|
||||
libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \
|
||||
libxcomposite1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
|
||||
libxss1 libxtst6 libatomic1 libxcomposite1 libxrender1 libxrandr2 libxkbcommon-x11-0 \
|
||||
libfontconfig1 libdbus-1-3 libnss3 libx11-xcb1 python3-tk stalonetray inotify-tools \
|
||||
pcmanfm
|
||||
libfontconfig1 libdbus-1-3 libnss3 libx11-xcb1 stalonetray inotify-tools
|
||||
|
||||
ARG INSTALL_PCMANFM
|
||||
RUN if [ "$INSTALL_PCMANFM" = "true" ]; then \
|
||||
apt-get install -y --no-install-recommends pcmanfm; \
|
||||
fi
|
||||
|
||||
RUN pip install --no-cache-dir python-xlib
|
||||
|
||||
@@ -52,25 +57,29 @@ RUN case "$TARGETPLATFORM" in \
|
||||
rm -f wechat.deb && \
|
||||
echo "✅ WeChat installation completed for $WECHAT_ARCH"
|
||||
|
||||
# Install QQ based on target architecture
|
||||
RUN case "$TARGETPLATFORM" in \
|
||||
"linux/amd64") \
|
||||
QQ_URL="https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.22_251203_amd64_01.deb"; \
|
||||
QQ_ARCH="x86_64" ;; \
|
||||
"linux/arm64") \
|
||||
QQ_URL="https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.22_251203_arm64_01.deb"; \
|
||||
QQ_ARCH="arm64" ;; \
|
||||
*) \
|
||||
echo "❌ Unsupported platform: $TARGETPLATFORM" >&2; \
|
||||
echo "Supported platforms: linux/amd64, linux/arm64" >&2; \
|
||||
exit 1 ;; \
|
||||
esac && \
|
||||
echo "📦 Downloading QQ for $QQ_ARCH architecture..." && \
|
||||
curl -fsSL -o qq.deb "$QQ_URL" && \
|
||||
echo "🔧 Installing QQ..." && \
|
||||
(dpkg -i qq.deb || (apt-get update && apt-get install -f -y && dpkg -i qq.deb)) && \
|
||||
rm -f qq.deb && \
|
||||
echo "✅ QQ installation completed for $QQ_ARCH"
|
||||
# Install QQ based on target architecture (optional)
|
||||
ARG INSTALL_QQ
|
||||
RUN if [ "$INSTALL_QQ" = "true" ]; then \
|
||||
case "$TARGETPLATFORM" in \
|
||||
"linux/amd64") \
|
||||
QQ_URL="https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.22_251203_amd64_01.deb"; \
|
||||
QQ_ARCH="x86_64" ;; \
|
||||
"linux/arm64") \
|
||||
QQ_URL="https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.22_251203_arm64_01.deb"; \
|
||||
QQ_ARCH="arm64" ;; \
|
||||
*) \
|
||||
echo "❌ Unsupported platform: $TARGETPLATFORM" >&2; \
|
||||
exit 1 ;; \
|
||||
esac && \
|
||||
echo "📦 Downloading QQ for $QQ_ARCH architecture..." && \
|
||||
curl -fsSL -o qq.deb "$QQ_URL" && \
|
||||
echo "🔧 Installing QQ..." && \
|
||||
(dpkg -i qq.deb || (apt-get update && apt-get install -f -y && dpkg -i qq.deb)) && \
|
||||
rm -f qq.deb && \
|
||||
echo "✅ QQ installation completed for $QQ_ARCH"; \
|
||||
else \
|
||||
echo "⏭️ Skipping QQ installation (INSTALL_QQ=$INSTALL_QQ)"; \
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
RUN apt-get purge -y --autoremove
|
||||
|
||||
11
README.md
11
README.md
@@ -63,6 +63,12 @@ Docker Hub镜像:
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri nickrunning/wechat-selkies:latest
|
||||
```
|
||||
|
||||
> **精简版镜像**:如果只需要微信(不含 QQ 和文件管理器),可使用 `minimal` 标签,镜像体积更小:
|
||||
> ```bash
|
||||
> docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ghcr.io/nickrunning/wechat-selkies:minimal
|
||||
> ```
|
||||
> 精简版也支持版本号标签,如 `:1.2.3-minimal`、`:1.2-minimal`,方便锁定特定版本。
|
||||
|
||||
2. **访问微信**
|
||||
|
||||
在浏览器中访问:`https://localhost:3001` 或 `https://<服务器IP>:3001`
|
||||
@@ -137,6 +143,11 @@ docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri nickr
|
||||
|
||||
在浏览器中访问:`https://localhost:3001` 或 `https://<服务器IP>:3001`
|
||||
|
||||
> **构建精简版**:源码部署时可通过 build-arg 构建仅含微信的精简镜像:
|
||||
> ```bash
|
||||
> docker build --build-arg INSTALL_QQ=false --build-arg INSTALL_PCMANFM=false -t wechat-selkies:minimal .
|
||||
> ```
|
||||
|
||||
### 配置说明
|
||||
|
||||
更多自定义配置请参考 [Selkies Base Images from LinuxServer](https://github.com/linuxserver/docker-baseimage-selkies)。
|
||||
|
||||
11
README_en.md
11
README_en.md
@@ -61,6 +61,12 @@ Docker Hub image:
|
||||
docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri nickrunning/wechat-selkies:latest
|
||||
```
|
||||
|
||||
> **Minimal image**: If you only need WeChat (without QQ and file manager), use the `minimal` tag for a smaller image:
|
||||
> ```bash
|
||||
> docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri ghcr.io/nickrunning/wechat-selkies:minimal
|
||||
> ```
|
||||
> Versioned minimal tags are also available, e.g. `:1.2.3-minimal`, `:1.2-minimal`, for pinning to a specific release.
|
||||
|
||||
2. **Access WeChat**
|
||||
|
||||
Open in browser: `https://localhost:3001` or `https://<server-ip>:3001`
|
||||
@@ -135,6 +141,11 @@ docker run -it -p 3001:3001 -v ./config:/config --device /dev/dri:/dev/dri nickr
|
||||
|
||||
Open in browser: `https://localhost:3001` or `https://<server-ip>:3001`
|
||||
|
||||
> **Build minimal version**: When building from source, use build-arg to create a WeChat-only image:
|
||||
> ```bash
|
||||
> docker build --build-arg INSTALL_QQ=false --build-arg INSTALL_PCMANFM=false -t wechat-selkies:minimal .
|
||||
> ```
|
||||
|
||||
### Configuration
|
||||
|
||||
For more custom configurations, please refer to [Selkies Base Images from LinuxServer](https://github.com/linuxserver/docker-baseimage-selkies).
|
||||
|
||||
Reference in New Issue
Block a user