feat: add more image tag

This commit is contained in:
engigu
2026-02-06 21:37:35 +08:00
parent a04d599b16
commit 60d6fb2525
15 changed files with 102 additions and 16 deletions
+47 -8
View File
@@ -6,7 +6,7 @@ on:
branches: branches:
- main - main
paths: paths:
- 'Dockerfile.base' - 'docker/Dockerfile.base'
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
@@ -17,10 +17,39 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
base_type: [debian, alpine, debian13]
platform: platform:
- linux/amd64 - linux/amd64
- linux/arm64 - linux/arm64
- linux/arm/v7 include:
- base_type: debian
platform: linux/arm/v7
dockerfile: docker/Dockerfile.base
tag_suffix: ""
- base_type: debian
platform: linux/amd64
dockerfile: docker/Dockerfile.base
tag_suffix: ""
- base_type: debian
platform: linux/arm64
dockerfile: docker/Dockerfile.base
tag_suffix: ""
- base_type: alpine
platform: linux/amd64
dockerfile: docker/Dockerfile.alpine.base
tag_suffix: "-alpine"
- base_type: alpine
platform: linux/arm64
dockerfile: docker/Dockerfile.alpine.base
tag_suffix: "-alpine"
- base_type: debian13
platform: linux/amd64
dockerfile: docker/Dockerfile.debian13.base
tag_suffix: "-debian13"
- base_type: debian13
platform: linux/arm64
dockerfile: docker/Dockerfile.debian13.base
tag_suffix: "-debian13"
permissions: permissions:
contents: read contents: read
@@ -34,7 +63,7 @@ jobs:
id: platform id: platform
run: | run: |
platform=${{ matrix.platform }} platform=${{ matrix.platform }}
echo "pair=${platform//\//-}" >> $GITHUB_OUTPUT echo "pair=${platform//\//-}-${{ matrix.base_type }}" >> $GITHUB_OUTPUT
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@@ -56,14 +85,14 @@ jobs:
images: | images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=raw,value=base type=raw,value=base${{ matrix.tag_suffix }}
- name: Build and push by digest - name: Build and push by digest
id: build id: build
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./Dockerfile.base file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }} platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true outputs: type=image,name=${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
@@ -88,6 +117,16 @@ jobs:
merge: merge:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
strategy:
matrix:
base_type: [debian, alpine, debian13]
include:
- base_type: debian
tag: base
- base_type: alpine
tag: base-alpine
- base_type: debian13
tag: base-debian13
permissions: permissions:
contents: read contents: read
@@ -101,7 +140,7 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: /tmp/digests path: /tmp/digests
pattern: digests-* pattern: digests-*-${{ matrix.base_type }}
merge-multiple: true merge-multiple: true
- name: Set up Docker Buildx - name: Set up Docker Buildx
@@ -121,7 +160,7 @@ jobs:
images: | images: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=raw,value=base type=raw,value=${{ matrix.tag }}
- name: Create manifest list and push - name: Create manifest list and push
working-directory: /tmp/digests working-directory: /tmp/digests
@@ -131,4 +170,4 @@ jobs:
- name: Inspect image - name: Inspect image
run: | run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:base docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
+5 -4
View File
@@ -51,6 +51,7 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./docker/Dockerfile
platforms: linux/amd64 platforms: linux/amd64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
@@ -71,8 +72,8 @@ jobs:
port: ${{ secrets.DEPLOY_PORT }} port: ${{ secrets.DEPLOY_PORT }}
script: | script: |
cd ${{ secrets.DEPLOY_PATH }} cd ${{ secrets.DEPLOY_PATH }}
docker-compose pull docker-compose -f docker/docker-compose.yml pull
docker-compose up -d docker-compose -f docker/docker-compose.yml up -d
- name: Deploy to X server - name: Deploy to X server
uses: appleboy/ssh-action@v1.2.0 uses: appleboy/ssh-action@v1.2.0
@@ -83,5 +84,5 @@ jobs:
port: ${{ secrets.DEPLOY_PORT }} port: ${{ secrets.DEPLOY_PORT }}
script: | script: |
cd ${{ secrets.DEPLOY_X_PATH }} cd ${{ secrets.DEPLOY_X_PATH }}
docker-compose pull docker-compose -f docker/docker-compose.yml pull
docker-compose up -d docker-compose -f docker/docker-compose.yml up -d
+1
View File
@@ -50,6 +50,7 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./docker/Dockerfile
platforms: linux/amd64 platforms: linux/amd64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
+1
View File
@@ -53,6 +53,7 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./docker/Dockerfile
platforms: linux/arm64 platforms: linux/arm64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
+1
View File
@@ -62,6 +62,7 @@ jobs:
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./docker/Dockerfile
platforms: ${{ matrix.platform }} platforms: ${{ matrix.platform }}
build-args: | build-args: |
VERSION=${{ github.ref_name }} VERSION=${{ github.ref_name }}
+1
View File
@@ -48,3 +48,4 @@ configs/config.local.json
__pycache__/ __pycache__/
# Misc # Misc
.stfolder
+3
View File
@@ -0,0 +1,3 @@
.git/
web/node_modules
web/dist
+3 -3
View File
@@ -66,7 +66,7 @@ deps:
# Docker build # Docker build
docker-build: docker-build:
docker build -t $(BINARY) . docker build -t $(BINARY) -f docker/Dockerfile .
# Docker run # Docker run
docker-run: docker-run:
@@ -74,11 +74,11 @@ docker-run:
# Docker compose up # Docker compose up
docker-up: docker-up:
docker-compose up -d docker-compose -f docker/docker-compose.yml up -d
# Docker compose down # Docker compose down
docker-down: docker-down:
docker-compose down docker-compose -f docker/docker-compose.yml down
# Help # Help
help: help:
+1 -1
View File
@@ -130,7 +130,7 @@ COPY --from=frontend-builder /app/web/dist ./internal/static/dist
# Copy configs and entrypoint # Copy configs and entrypoint
COPY --from=backend-builder /app/configs ./configs COPY --from=backend-builder /app/configs ./configs
COPY docker-entrypoint.sh . COPY docker/docker-entrypoint.sh .
# Copy sync.py to /opt # Copy sync.py to /opt
COPY custom/sync.py /opt/sync.py COPY custom/sync.py /opt/sync.py
+24
View File
@@ -0,0 +1,24 @@
FROM alpine:3.19
ENV TZ=Asia/Shanghai
ENV PATH="/app/envs/node/bin:/app/envs/python/bin:$PATH"
ENV NODE_PATH="/app/envs/node/lib/node_modules"
# 安装必要系统工具 + Node + Python
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk add --no-cache \
tzdata \
git \
gcc \
musl-dev \
curl \
wget \
vim \
nodejs \
npm \
python3 \
py3-pip \
htop \
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo "${TZ}" > /etc/timezone \
&& rm -rf /var/cache/apk/*
+15
View File
@@ -0,0 +1,15 @@
FROM debian:trixie-slim
ENV TZ=Asia/Shanghai
ENV PATH="/app/envs/node/bin:/app/envs/python/bin:$PATH"
ENV NODE_PATH="/app/envs/node/lib/node_modules"
# 安装必要系统工具 + Node + Python
RUN sed -i 's@deb.debian.org@mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources \
&& sed -i 's@security.debian.org@mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list.d/debian.sources \
&& echo "${TZ}" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
tzdata git gcc curl wget vim nodejs htop npm python3 python3-venv python3-pip \
&& rm -rf /var/lib/apt/lists/*