~Docker构建优化

This commit is contained in:
juewuy
2025-12-17 22:00:25 +08:00
parent c6a18a8981
commit aa324029cd
2 changed files with 9 additions and 19 deletions

View File

@@ -1,6 +1,8 @@
name: docker-build-push
name: Build Docker image for ShellCrash
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
@@ -14,25 +16,24 @@ jobs:
- name: Checkout
uses: actions/checkout@v5
with:
ref: dev
fetch-depth: 1
# QEMU 支持
- name: Read version
id: read_version
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 登录 Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# 构建并推送
- name: Build and push (multi-arch)
uses: docker/build-push-action@v6
with:
@@ -46,4 +47,4 @@ jobs:
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/shellcrash:latest
${{ secrets.DOCKERHUB_USERNAME }}/shellcrash:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/shellcrash:${{ env.VERSION }}

View File

@@ -7,14 +7,7 @@ ARG TARGETPLATFORM
ARG TZ=Asia/Shanghai
ARG S6_OVERLAY_V=v3.2.1.0
RUN apk add --no-cache \
curl \
ca-certificates \
tar \
gzip \
xz \
tzdata \
dcron
RUN apk add --no-cache curl tzdata
# 时区
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
@@ -60,16 +53,12 @@ ARG TZ=Asia/Shanghai
LABEL org.opencontainers.image.source="https://github.com/juewuy/ShellCrash"
#安装依赖
RUN apk add --no-cache \
tini \
openrc \
wget \
ca-certificates \
tzdata \
nftables \
iproute2 \
dcron
#清理openrc
RUN apk del openrc && rm -rf /etc/runlevels/* /run/openrc
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo "${TZ}" > /etc/timezone